multi-indexed tdb

Stefan (metze) Metzmacher metze at samba.org
Thu Aug 3 07:01:21 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Volker Lendecke schrieb:
> Hi!
> 
> 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

Hi Volker,

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.

metze
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFE0Z9Bm70gjA5TCD8RAouUAKCBT6tbUydBM3tNS3fCWDlF3Ss6HwCfaUtI
iDScComKEZ2cajWBqLLEjfs=
=6tmq
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list