Skip to main content

Ralsina.Me — Roberto Alsina's website

Need a flat DB? Use TDB!

No, do not use gdb­m. Prob­a­bly not bdb ei­ther.

TDB al­lows for con­cur­rent writes. So, if you want to store some da­ta in a file in your ap­pli­ca­tion/­tool/­com­mand/what­ev­er, and there is a chance that you need con­cur­rent writes... TDB is re­al­ly the on­ly rea­son­able choice I know.

You can even have dis­trib­uted TDB­s.

I found out about TDB while writ­ing a per­sis­tant cache for a lit­tle tool (a qmail plug­in). Since by its na­ture it would have con­cur­rent writes all the time, I was aim­ing for some­thing like mem­cached, or its disk-based ver­sion... but TDB solves the prob­lem nice­ly and ef­fort­less­ly.

So, if you need a flat DB (a.k.a anony­mous blobs with a sin­gle in­dex, a.k.a a hash in a file)...

Sebastián Benítez / 2006-09-02 21:33:

You could also try QDBM http://qdbm.sourceforge.net/

It's fast and has different interfaces depending on what you need. Like a GDBM-like interface, or a transactional interface.

Roberto Alsina / 2006-09-02 23:13:

A quick look st the docs show QDBM allows only one writer connection.

Kurt Pfeifle / 2006-09-03 17:52:

I'm sure you know who authored tdb (Andrew Tridgell, how is also the Samba and rsync developer lead)?

Did you have a look into "ldb" as well?

ldb is (c) by tridge too -- and it adds a really lightweight LDAP-like API to tdb, so you can have LDAP-like features for tdb without the overhead of a real LDAP server. "embedded LDAP" if you like...

AFAIK, a while ago Aaron Seigo has looked into utilizing tdb in KDE4 for storing settings... but I'm not up to date what his final findings are.

Cheers,
Kurt


Contents © 2000-2024 Roberto Alsina