]> git.ozlabs.org Git - ccan/blob - ccan/tdb2/doc/TDB1_porting.txt
fee020073b748df6f6d6360abe6e4ebad27e8122
[ccan] / ccan / tdb2 / doc / TDB1_porting.txt
1 Interface differences between TDB1 and TDB2.
2
3 - tdb2 functions return 0 on success, and a negative error on failure,
4   whereas tdb1 functions returned 0 on success, and -1 on failure.  tdb1
5   then used tdb_error() to determine the error.
6
7 - tdb2's tdb_fetch() returns an error, tdb1's returned the data directly
8   (or tdb_null, and you were supposed to check tdb_error() to find out why).
9
10 - tdb2's tdb_nextkey() frees the old key's dptr, in tdb2 you needed to do
11   this manually.
12
13 - tdb1's tdb_open/tdb_open_ex took an explicit hash size.  tdb2's hash table
14   resizes as required.
15
16 - tdb2 uses a linked list of attribute structures to implement logging and
17   alternate hashes.  tdb1 used tdb_open_ex, which was not extensible.
18
19 - tdb2 does locking on read-only databases (ie. O_RDONLY passed to tdb_open).
20   tdb1 did not: use the TDB_NOLOCK flag if you want to suppress locking.
21
22 - tdb2's log function is simpler than tdb1's log function.  The string is
23   already formatted, and it takes an enum tdb_log_level not a tdb_debug_level,
24   and which has only three values: TDB_LOG_ERROR, TDB_LOG_USE_ERROR and
25   TDB_LOG_WARNING.