1
#ifndef _SLMDB_H_INCLUDED_
2
#define _SLMDB_H_INCLUDED_
29
#define SLMDB_JMP_BUF jmp_buf
31
#define SLMDB_JMP_BUF sigjmp_buf
35
* All data structure members are private.
38
size_t curr_limit; /* database soft size limit */
39
int size_incr; /* database expansion factor */
40
size_t hard_limit; /* database hard size limit */
41
int open_flags; /* open() flags */
42
int lmdb_flags; /* LMDB-specific flags */
43
int slmdb_flags; /* bulk-mode flag */
44
MDB_env *env; /* database environment */
45
MDB_dbi dbi; /* database instance */
46
MDB_txn *txn; /* bulk transaction */
47
int db_fd; /* database file handle */
48
MDB_cursor *cursor; /* iterator */
49
MDB_val saved_key; /* saved cursor key buffer */
50
size_t saved_key_size; /* saved cursor key buffer size */
51
void (*longjmp_fn) (void *, int);/* exception handling */
52
void (*notify_fn) (void *, int,...); /* workaround notification */
53
void (*assert_fn) (void *, const char *); /* assert notification */
54
void *cb_context; /* call-back context */
55
int api_retry_count; /* slmdb(3) API call retry count */
56
int bulk_retry_count; /* bulk_mode retry count */
57
int api_retry_limit; /* slmdb(3) API call retry limit */
58
int bulk_retry_limit; /* bulk_mode retry limit */
61
#define SLMDB_FLAG_BULK (1 << 0)
63
extern int slmdb_init(SLMDB *, size_t, int, size_t);
64
extern int slmdb_open(SLMDB *, const char *, int, int, int);
65
extern int slmdb_get(SLMDB *, MDB_val *, MDB_val *);
66
extern int slmdb_put(SLMDB *, MDB_val *, MDB_val *, int);
67
extern int slmdb_del(SLMDB *, MDB_val *);
68
extern int slmdb_cursor_get(SLMDB *, MDB_val *, MDB_val *, MDB_cursor_op);
69
extern int slmdb_control(SLMDB *, int,...);
70
extern int slmdb_close(SLMDB *);
72
#define slmdb_fd(slmdb) ((slmdb)->db_fd)
73
#define slmdb_curr_limit(slmdb) ((slmdb)->curr_limit)
75
#define SLMDB_CTL_END 0
76
#define SLMDB_CTL_LONGJMP_FN 1 /* exception handling */
77
#define SLMDB_CTL_NOTIFY_FN 2 /* debug logging function */
78
#define SLMDB_CTL_CB_CONTEXT 3 /* call-back context */
79
#define SLMDB_CTL_HARD_LIMIT 4 /* hard database size limit */
80
#define SLMDB_CTL_API_RETRY_LIMIT 5 /* per slmdb(3) API call */
81
#define SLMDB_CTL_BULK_RETRY_LIMIT 6 /* per bulk update */
82
#define SLMDB_CTL_ASSERT_FN 7 /* report assertion failure */
84
typedef void (*SLMDB_NOTIFY_FN) (void *, int,...);
85
typedef void (*SLMDB_LONGJMP_FN) (void *, int);
86
typedef void (*SLMDB_ASSERT_FN) (void *, const char *);
91
/* The Secure Mailer license must be distributed with this software.