X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftdb2.h;h=4fd34e8b5574d0557abe7e5c9fae5b95cead990b;hp=3374e0cac6ba310883be85c06e600ef822bd0f25;hb=012f68a0738e2190580f4639321d18ad5f4611c2;hpb=39b9d9ef8c05224b5f2685003160f4092fbd7045 diff --git a/ccan/tdb2/tdb2.h b/ccan/tdb2/tdb2.h index 3374e0ca..4fd34e8b 100644 --- a/ccan/tdb2/tdb2.h +++ b/ccan/tdb2/tdb2.h @@ -96,6 +96,25 @@ typedef struct tdb_data { size_t dsize; } TDB_DATA; +/** + * enum TDB_ERROR - error returns for TDB + * + * See Also: + * tdb_errorstr() + */ +enum TDB_ERROR { + TDB_SUCCESS = 0, /* No error. */ + TDB_ERR_CORRUPT = -1, /* We read the db, and it was bogus. */ + TDB_ERR_IO = -2, /* We couldn't read/write the db. */ + TDB_ERR_LOCK = -3, /* Locking failed. */ + TDB_ERR_OOM = -4, /* Out of Memory. */ + TDB_ERR_EXISTS = -5, /* The key already exists. */ + TDB_ERR_NOEXIST = -6, /* The key does not exist. */ + TDB_ERR_EINVAL = -7, /* You're using it wrong. */ + TDB_ERR_RDONLY = -8, /* The database is read-only. */ + TDB_ERR_LAST = TDB_ERR_RDONLY +}; + /** * tdb_store - store a key/value pair in a tdb. * @tdb: the tdb context returned from tdb_open() @@ -142,17 +161,6 @@ struct tdb_data tdb_fetch(struct tdb_context *tdb, struct tdb_data key); * See Also: * tdb_error(), tdb_errorstr() */ -enum TDB_ERROR { - TDB_SUCCESS=0, /* No error. */ - TDB_ERR_CORRUPT, /* We read the db, and it was bogus. */ - TDB_ERR_IO, /* We couldn't read/write the db. */ - TDB_ERR_LOCK, /* Locking failed. */ - TDB_ERR_OOM, /* Out of Memory. */ - TDB_ERR_EXISTS, /* The key already exists. */ - TDB_ERR_NOEXIST, /* The key does not exist. */ - TDB_ERR_EINVAL, /* You're using it wrong. */ - TDB_ERR_RDONLY /* The database is read-only. */ -}; /** * tdb_error - fetch the last error value from the tdb. @@ -377,10 +385,6 @@ char *tdb_summary(struct tdb_context *tdb, enum tdb_summary_flags flags); -int64_t tdb_traverse_read(struct tdb_context *tdb, - tdb_traverse_func fn, void *p); - - /** * enum tdb_attribute_type - descriminator for union tdb_attribute. */