Web lists-archives.com

Re: [PATCH v5 10/40] Add initial external odb support




On Thu, Aug 03, 2017 at 12:34:25PM -0700, Junio C Hamano wrote:

> > +int external_odb_get_object(const unsigned char *sha1)
> > +{
> > +	struct odb_helper *o;
> > +	const char *path;
> > +
> > +	if (!external_odb_has_object(sha1))
> > +		return -1;
> 
> This probably would not matter, as I do not expect one repository to
> connect to and backed by very many external odb instances, but I
> would have expected that the interaction would go more like "ah, we
> need this object that is lacking locally. let's see if there is
> anybody with the object. now we found who claims to have the object,
> let's ask that guy (and nobody else) to give the object to us".
> 
> IOW, I would have expected two functions:
> 
>  - struct odb_helper *external_odb_with(struct object_id *oid);
>  - int external_odb_get(struct object_id *oid, struct odb_helper *odb);

One advantage of walking through them linearly and asking "can you get
it?" is that it gracefully handles external odbs which aren't available.
That can be used for redundancy, or for situations where a preferred
odb isn't always available (e.g., a fast server which is only available
when you're on a particular network).

-Peff