All righty, folks ... anyone looking to build a database backend of their
own, please check out the latest batch of changes in the git repository. 
It basically works like this: 
  
 * database.c has been renamed to database_bdb.c 
 * database.h now basically declares an API for storage backends to use 
 * All functions beginning with cdb_ were renamed to bdb_ 
 * The cdb_ functions are now just pointers 
 * During initialization, the cdb_ functions are assigned to their corresponding
bdb_ functions 
  
 I've tested it a bit and everything seems to be working just as it was before.
 I did the whole thing with function pointer assignment because I didn't want
to write a giant batch of wrapper functions to marshal calls to the correct
backend and then require one more step up the stack for every call.  Since
only one backend will ever be used at a time, we load the pointers at 
initialization
time and then everything works exactly as it did before. 
  
 Here's where I expect to go with this next: 
  
 * A new server/database.c file will come into existence, and it will handle
the binding of the selected backend 
 * Backends will move to a separate part of the directory tree, probably 
server/modules.
 They will need to have a different initialization convention because the
data store is initialized long before server extension modules are initialized.

 * Backends that are incompatible with a particular host (for example, LMDB
on 32-bit) will simply be skipped in the build. 
 * We'll have to add another function to scan the data directory and detect
what backend was used to write any existing database that might already be
there.  If an existing database is present, we will automatically load the
correct backend. 
 * Where no existing database is present, we will choose one in
order of preference.  A command line switch will of course be available to
override the server's decision. 
  
 Does that sound acceptable to you all?  This should make it possible to bring
experimental backends into the tree without foisting them upon the user 
community.

 

Reply via email to