[Sheepdog] [PATCH v4 01/12] sheep: hide some minor store layout aware operations

Liu Yuan namei.unix at gmail.com
Wed Dec 28 14:19:02 CET 2011


On 12/28/2011 09:11 PM, Christoph Hellwig wrote:

>>  
>> +static void get_store_dir(struct strbuf *buf, int epoch)
>> +{
>> +	if (!strcmp(store.driver_name, "simple"))
>> +		strbuf_addf(buf, "%s%08u", obj_path, epoch);
>> +	else if (!strcmp(store.driver_name, "farm"))
>> +		strbuf_addf(buf, "%s", obj_path);
>> +}
> 
> Wouldn't it be better to have a get_store_dir in struct store_driver
> instead of hardcoding the store names here?
> 


I am suspecting that only Simple Store will assume epoch/data layout, so
I think we'd better put up with this ugliness, and see if there is a
real need to abstract out this operation when new backend store is added
later.

Plus, this causes smallest changes to adopt it to farm.

Thanks,
Yuan



More information about the sheepdog mailing list