Web lists-archives.com

Re: [PATCH v5 14/40] external-odb: accept only blobs for now




Christian Couder <christian.couder@xxxxxxxxx> writes:

> The mechanism to decide which blobs should be sent to which
> external object database will be very simple for now.
> If the external odb helper support any "put_*" instruction
> all the new blobs will be sent to it.
>
> Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
> ---
>  external-odb.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/external-odb.c b/external-odb.c
> index 82fac702e8..a4f8c72e1c 100644
> --- a/external-odb.c
> +++ b/external-odb.c
> @@ -124,6 +124,10 @@ int external_odb_put_object(const void *buf, size_t len,
>  {
>  	struct odb_helper *o;
>  
> +	/* For now accept only blobs */
> +	if (strcmp(type, "blob"))
> +		return 1;
> +

I somehow doubt that a policy decision like this should be made at
this layer.  Shouldn't it be encoded in the capability the other
side supports, or determined at runtime per each individual object
when a "put" is attempted (i.e. allow the other side to say "You
tell me that you want me to store an object of type X and size Y;
I cannot do that, sorry").

>  	external_odb_init();
>  
>  	for (o = helpers; o; o = o->next) {