[Date Prev][Date Next] [Chronological] [Thread] [Top]

tool entry points



While looking at ITS#3979 and implementing the 3 new tool entry points for backglue, I decided I really dislike this tool API. first/next iterators always annoy me, there should only be a single iterator function (you feed it a zero-value to get the process started). And the use of IDs for the iterator here is problematic because most backends don't support entryIDs...

I suggest
   Entry * tool_entry_get(BackendDB *be, struct berval *dn, void **iter);

   int tool_entry_put(BackendDB *be, Entry *e, int flags);
#define TOOL_PUT_ENTRY   1
#define TOOL_PUT_UPDATE  2

tool_entry_put(be, e, TOOL_PUT_ENTRY)
  will add a new entry and generate its indices.

tool_entry_put(be, e, TOOL_PUT_ENTRY|TOOL_PUT_UPDATE)
  will overwrite an entry - replaces tool_entry_modify.

tool_entry_put(be, e, 0)
  will only generate the indices. - replaces tool_entry_reindex.

void *iter = NULL;
struct berval dn;

tool_entry_get(be, NULL, &iter)
   return the first (and subsequent) entry in the DB.

tool_entry_get(be, &dn, NULL)
   return the named entry.

Since only back-bdb, back-ldbm, and back-null implement all of these APIs it shouldn't be much work to update them. Abstracting the iterator will also make it possible to implement for back-ldap (if desired - still not sure it's a good idea).

--
 -- Howard Chu
 Chief Architect, Symas Corp.  http://www.symas.com
 Director, Highland Sun        http://highlandsun.com/hyc
 OpenLDAP Core Team            http://www.openldap.org/project/