Stefan (metze) Metzmacher
metze at samba.org
Thu Aug 3 07:01:21 GMT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Volker Lendecke schrieb:
> Attached find a trivial wrapper around tdb that might make
> multi-indexed tdb files sane.
> The idea is that for the modifying functions you provide a
> callback function that creates a list of index strings out
> of a record. Thanks to Jeremy for this good idea, I had
> something more complicated in mind.
> The tdb_multindex.c lib creates a random primary key for you
> and sets the index records to that primary key under a tdb
> transaction. That's basically the whole idea.
> What's missing is tdb_reindex and tdb_traverse_indexed
I had a simular idea:-)
I thought about having a separate hash array different
subkeys, (the idea a virtuel named databases)
so that the traverse call would not need to go through
all records and filter out the wrong ones. Instead
a traverse call would only go through the correct records.
This would also be very useful for implementing ldb partitions
and ldb indexes for the whole tree, the partition and a container.
But your version looks good, and seems very simple.
Maybe a private pointer to the index fn would be useful,
so that the caller could pass a struct to it,
otherwise the index fn need to parse the TDB_DATA blob.
Also a magic version key would be good, so that the file
and be easy identified as a tdb with multiple indexes.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the samba-technical