Clarification of the above commit -- because it's important. 
  
 When traversing an entire table (as opposed to just fetching one row for
which you already know the key) the backend API now returns both a key and
a value.  This is done by returning a "struct cdbkeyval" which simply contains
a pair of "struct cdbdata", one for the key and one for the value. 
  
 Yes, my discovery that you've been able to return a struct by value from
a function in C for the last couple of decades has already reflected itself
in Citadel.  :) 
  
 All of this is based on a *new* rule in the backend interface: when you fetch
an item from the database, either with cdb_fetch() or cdb_next_item(), the
caller does NOT become the owner of the memory it points to.  This is how
Berkeley DB operates by default (and I changed it back to this mode over the
past week) and it's the *only* way LMDB can operate. 
  

Why all the fuss?  Well, let me tell you; thanks for asking! 
  
 ctdldump and ctdlload currently call Berkeley DB directly.  This is 
non-awesome.
 It means that when we add more backends we would have to write new versions
of ctdldump and ctdlload for each one.  Not gonna do it.  ctdldump and ctdlload
will be modified to use the same backend interface that citserver uses.  Then
we'll be able to dump and load in any format on any machine.  But ctdldump
needs to know the keys, not just the values.  And so, cdb_next_item() now
returns both. 
 

Reply via email to