]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/tdb1.h
tdb2: make tdb1_null static.
[ccan] / ccan / tdb2 / tdb1.h
index b2435ba53e3eff8a1f04a2c35220aaf4c54c9fa5..54b6d936d49b67de18aecd95b121a56ed616d977 100644 (file)
 #endif
 
 
-/** Flags for tdb1_open() */
-#define TDB1_DEFAULT 0 /** just a readability place holder */
-#define TDB1_CLEAR_IF_FIRST 1 /** If this is the first open, wipe the db */
-#define TDB1_INTERNAL 2 /** Don't store on disk */
-#define TDB1_NOLOCK   4 /** Don't do any locking */
-#define TDB1_NOMMAP   8 /** Don't use mmap */
-#define TDB1_CONVERT 16 /** Convert endian (internal use) */
-#define TDB1_BIGENDIAN 32 /** Header is big-endian (internal use) */
-#define TDB1_NOSYNC   64 /** Don't use synchronous transactions */
-#define TDB1_SEQNUM   128 /** Maintain a sequence number */
-#define TDB1_VOLATILE   256 /** Activate the per-hashchain freelist, default 5 */
-#define TDB1_ALLOW_NESTING 512 /** Allow transactions to nest */
-#define TDB1_DISALLOW_NESTING 1024 /** Disallow transactions to nest */
-#define TDB1_INCOMPATIBLE_HASH 2048 /** Better hashing: can't be opened by tdb < 1.2.6. */
+void tdb1_set_max_dead(struct tdb_context *tdb, int max_dead);
 
-/** 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,
-                             const char *, void *);
-typedef unsigned int (*tdb1_hash_func)(TDB_DATA *key);
-
-struct tdb1_logging_context {
-        tdb1_log_func log_fn;
-        void *log_private;
-};
-
-struct tdb1_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,
-                        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);
-
-TDB_DATA tdb1_fetch(struct tdb1_context *tdb, TDB_DATA key);
-
-int tdb1_parse_record(struct tdb1_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_store(struct tdb1_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_close(struct tdb1_context *tdb);
-
-TDB_DATA tdb1_firstkey(struct tdb1_context *tdb);
-
-TDB_DATA tdb1_nextkey(struct tdb1_context *tdb, TDB_DATA key);
-
-int tdb1_traverse(struct tdb1_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_exists(struct tdb1_context *tdb, TDB_DATA key);
-
-int tdb1_lockall(struct tdb1_context *tdb);
-
-int tdb1_unlockall(struct tdb1_context *tdb);
-
-int tdb1_lockall_read(struct tdb1_context *tdb);
-
-int tdb1_unlockall_read(struct tdb1_context *tdb);
-
-int tdb1_transaction_start(struct tdb1_context *tdb);
-
-int tdb1_transaction_prepare_commit(struct tdb1_context *tdb);
-
-int tdb1_transaction_commit(struct tdb1_context *tdb);
-
-int tdb1_transaction_cancel(struct tdb1_context *tdb);
-
-int tdb1_get_seqnum(struct tdb1_context *tdb);
-
-int tdb1_hash_size(struct tdb1_context *tdb);
-
-void tdb1_increment_seqnum_nonblock(struct tdb1_context *tdb);
-
-unsigned int tdb1_jenkins_hash(TDB_DATA *key);
-
-int tdb1_check(struct tdb1_context *tdb,
-             int (*check) (TDB_DATA key, TDB_DATA data, void *private_data),
-             void *private_data);
+uint64_t tdb1_incompatible_hash(const void *key, size_t len, uint64_t seed, void *);
 
 /* @} ******************************************************************/
 
-/* 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);
-
-
-/* wipe and repack */
-int tdb1_wipe_all(struct tdb1_context *tdb);
-int tdb1_repack(struct tdb1_context *tdb);
-
-/* Debug functions. Not used in production. */
-char *tdb1_summary(struct tdb1_context *tdb);
-
-extern TDB_DATA tdb1_null;
-
 #endif /* tdb1.h */