diff options
Diffstat (limited to 'lib/tdb2/tdb1.h')
-rw-r--r-- | lib/tdb2/tdb1.h | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/lib/tdb2/tdb1.h b/lib/tdb2/tdb1.h index 5227bbbbc8..78d42b398c 100644 --- a/lib/tdb2/tdb1.h +++ b/lib/tdb2/tdb1.h @@ -36,11 +36,8 @@ #endif -/** This is the context structure that is returned from a db open. */ -typedef struct tdb1_context TDB1_CONTEXT; - -typedef int (*tdb1_traverse_func)(struct tdb1_context *, TDB_DATA, TDB_DATA, void *); -typedef void (*tdb1_log_func)(struct tdb1_context *, enum tdb_log_level, enum TDB_ERROR, +typedef int (*tdb1_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *); +typedef void (*tdb1_log_func)(struct tdb_context *, enum tdb_log_level, enum TDB_ERROR, const char *, void *); typedef uint64_t (*tdb1_hash_func)(const void *key, size_t len, uint64_t seed, void *data); @@ -50,84 +47,84 @@ struct tdb1_logging_context { void *log_private; }; -struct tdb1_context *tdb1_open(const char *name, int hash_size, int tdb1_flags, +struct tdb_context *tdb1_open(const char *name, int hash_size, int tdb1_flags, int open_flags, mode_t mode); -struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags, +struct tdb_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags, int open_flags, mode_t mode, const struct tdb1_logging_context *log_ctx, tdb1_hash_func hash_fn); -void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead); +void tdb1_set_max_dead(struct tdb_context *tdb, int max_dead); -TDB_DATA tdb1_fetch(struct tdb1_context *tdb, TDB_DATA key); +TDB_DATA tdb1_fetch(struct tdb_context *tdb, TDB_DATA key); -int tdb1_parse_record(struct tdb1_context *tdb, TDB_DATA key, +int tdb1_parse_record(struct tdb_context *tdb, TDB_DATA key, int (*parser)(TDB_DATA key, TDB_DATA data, void *private_data), void *private_data); -int tdb1_delete(struct tdb1_context *tdb, TDB_DATA key); +int tdb1_delete(struct tdb_context *tdb, TDB_DATA key); -int tdb1_store(struct tdb1_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); +int tdb1_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); -int tdb1_append(struct tdb1_context *tdb, TDB_DATA key, TDB_DATA new_dbuf); +int tdb1_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf); -int tdb1_close(struct tdb1_context *tdb); +int tdb1_close(struct tdb_context *tdb); -TDB_DATA tdb1_firstkey(struct tdb1_context *tdb); +TDB_DATA tdb1_firstkey(struct tdb_context *tdb); -TDB_DATA tdb1_nextkey(struct tdb1_context *tdb, TDB_DATA key); +TDB_DATA tdb1_nextkey(struct tdb_context *tdb, TDB_DATA key); -int tdb1_traverse(struct tdb1_context *tdb, tdb1_traverse_func fn, void *private_data); +int tdb1_traverse(struct tdb_context *tdb, tdb1_traverse_func fn, void *private_data); -int tdb1_traverse_read(struct tdb1_context *tdb, tdb1_traverse_func fn, void *private_data); +int tdb1_traverse_read(struct tdb_context *tdb, tdb1_traverse_func fn, void *private_data); -int tdb1_exists(struct tdb1_context *tdb, TDB_DATA key); +int tdb1_exists(struct tdb_context *tdb, TDB_DATA key); -int tdb1_lockall(struct tdb1_context *tdb); +int tdb1_lockall(struct tdb_context *tdb); -int tdb1_unlockall(struct tdb1_context *tdb); +int tdb1_unlockall(struct tdb_context *tdb); -int tdb1_lockall_read(struct tdb1_context *tdb); +int tdb1_lockall_read(struct tdb_context *tdb); -int tdb1_unlockall_read(struct tdb1_context *tdb); +int tdb1_unlockall_read(struct tdb_context *tdb); -int tdb1_transaction_start(struct tdb1_context *tdb); +int tdb1_transaction_start(struct tdb_context *tdb); -int tdb1_transaction_prepare_commit(struct tdb1_context *tdb); +int tdb1_transaction_prepare_commit(struct tdb_context *tdb); -int tdb1_transaction_commit(struct tdb1_context *tdb); +int tdb1_transaction_commit(struct tdb_context *tdb); -int tdb1_transaction_cancel(struct tdb1_context *tdb); +int tdb1_transaction_cancel(struct tdb_context *tdb); -int tdb1_get_seqnum(struct tdb1_context *tdb); +int tdb1_get_seqnum(struct tdb_context *tdb); -int tdb1_hash_size(struct tdb1_context *tdb); +int tdb1_hash_size(struct tdb_context *tdb); -void tdb1_increment_seqnum_nonblock(struct tdb1_context *tdb); +void tdb1_increment_seqnum_nonblock(struct tdb_context *tdb); uint64_t tdb1_incompatible_hash(const void *key, size_t len, uint64_t seed, void *); -int tdb1_check(struct tdb1_context *tdb, +int tdb1_check(struct tdb_context *tdb, int (*check) (TDB_DATA key, TDB_DATA data, void *private_data), void *private_data); /* @} ******************************************************************/ /* Low level locking functions: use with care */ -int tdb1_chainlock(struct tdb1_context *tdb, TDB_DATA key); -int tdb1_chainunlock(struct tdb1_context *tdb, TDB_DATA key); -int tdb1_chainlock_read(struct tdb1_context *tdb, TDB_DATA key); -int tdb1_chainunlock_read(struct tdb1_context *tdb, TDB_DATA key); +int tdb1_chainlock(struct tdb_context *tdb, TDB_DATA key); +int tdb1_chainunlock(struct tdb_context *tdb, TDB_DATA key); +int tdb1_chainlock_read(struct tdb_context *tdb, TDB_DATA key); +int tdb1_chainunlock_read(struct tdb_context *tdb, TDB_DATA key); /* wipe and repack */ -int tdb1_wipe_all(struct tdb1_context *tdb); -int tdb1_repack(struct tdb1_context *tdb); +int tdb1_wipe_all(struct tdb_context *tdb); +int tdb1_repack(struct tdb_context *tdb); /* Debug functions. Not used in production. */ -char *tdb1_summary(struct tdb1_context *tdb); +char *tdb1_summary(struct tdb_context *tdb); extern TDB_DATA tdb1_null; |