-
Notifications
You must be signed in to change notification settings - Fork 1
/
vdb.h
67 lines (56 loc) · 1.59 KB
/
vdb.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef BACKEND_VDB_H
#define BACKEND_VDB_H
#include "simvacation.h"
#ifdef HAVE_LMDB
#include <lmdb.h>
#endif
#ifdef HAVE_URCL
#include <urcl.h>
#endif /* HAVE_URCL */
typedef enum {
VDB_STATUS_OK,
VDB_STATUS_RECENT,
} vdb_status;
typedef struct vdb {
union {
int null;
#ifdef HAVE_URCL
urclHandle *redis;
#endif /* HAVE_URCL */
#ifdef HAVE_LMDB
MDB_env *lmdb;
#endif /* HAVE_LMDB */
};
yastr rcpt;
} VDB;
struct vdb_backend {
VDB *(*init)(const yastr);
void (*close)(VDB *);
vdb_status (*recent)(VDB *, const yastr, time_t);
vac_result (*store_reply)(VDB *, const yastr);
ucl_object_t *(*get_names)(VDB *);
void (*clean)(VDB *, const yastr);
void (*gc)(VDB *);
};
struct vdb_backend *vdb_backend(const char *);
VDB * vdb_init(const yastr);
void vdb_close(VDB *);
vdb_status vdb_recent(VDB *, const yastr, time_t);
vac_result vdb_store_reply(VDB *, const yastr);
ucl_object_t * vdb_get_names(VDB *);
void vdb_clean(VDB *, const yastr);
void vdb_gc(VDB *);
#ifdef HAVE_LMDB
VDB * lmdb_vdb_init(const yastr);
void lmdb_vdb_close(VDB *);
vdb_status lmdb_vdb_recent(VDB *, const yastr, time_t);
vac_result lmdb_vdb_store_reply(VDB *, const yastr);
void lmdb_vdb_gc(VDB *);
#endif /* HAVE_LMDB */
#ifdef HAVE_URCL
VDB * redis_vdb_init(const yastr);
void redis_vdb_close(VDB *);
vdb_status redis_vdb_recent(VDB *, const yastr, time_t);
vac_result redis_vdb_store_reply(VDB *, const yastr);
#endif /* HAVE_URCL */
#endif /* BACKEND_VDB_H */