Toru's Multi Storage Patch
Trond Norbye
Trond.Norbye at Sun.COM
Tue Feb 5 15:39:10 UTC 2008
On Feb 5, 2008, at 2:53 AM, Toru Maesaka wrote:
> G'day
>
> Thanks for the mention Brian. Yeah, I totally agree that the if/else
> approach not being a swarve solution since this creates extra
> execution paths. Though, mind you this was my first attempt on
> seeing the link in action.
>
> As for abstracting the storage behind a common interface, I'm
> thinking that I should really forget about external engines for now
> and concentrate on getting the current storage behind a interface,
> that is to be used in a common fashion later on. Making this
> loadable is probably not so difficult once we have this working. It
> is definitely on my todo list :-)
>
> Trond:
> Thanks for the feedback! I'm thinking using a char string for
> setting the storage parameters might be neat, such that:
>
> int (*sb_settings)(void*, const char*);
>
> where const char* can be something along the line of:
>
> "database_name:option1=foo:option2=foo:option3=foo" (somewhat like
> the DBI).
>
> Not sure if this is a good solution but it looks promising in my head.
>
> Any comments?
>
I see in my example that I forgot to pass this parameter to
create_instance in my example ;-)
My intension was to send it to initialize_storage as:
> MMCSTORAGE* initialize_storage(const char *library, const char
> *config)
But I forgot to insert it into the call to create_instance ;-):
>
> MMCSTORAGE* create_instance(settings*, int version, int *error);
> settings - The backend should be able to pick up the configuration
> parameters it needs
> version - The "protocol" version requested from the backend
> error - A place the backend can store a predefined error code
>
I was thinking of:
MMCSTORAGE* create_instance(settings* settings, const char* config,
int version, int &error)
config - would be specialized for this backend specified with a
command line option (like your -o option). The backend could treat it
as a file-name or a config string..
>
> settings - The backend should be able to pick up the configuration
> parameters it needs
> version - The "protocol" version requested from the backend
> error - A place the backend can store a predefined error code
>
Trond
More information about the memcached
mailing list