-
Notifications
You must be signed in to change notification settings - Fork 3
/
traildbc.di
109 lines (83 loc) · 3.37 KB
/
traildbc.di
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import std.stdint;
alias tdb_error = int32_t;
alias tdb_field = uint32_t;
alias tdb_val = uint64_t;
alias tdb_item = uint64_t;
enum tdb_opt_key
{
TDB_OPT_ONLY_DIFF_ITEMS = 100,
TDB_OPT_EVENT_FILTER = 101,
TDB_OPT_CURSOR_EVENT_BUFFER_SIZE = 102,
TDB_OPT_CONS_OUTPUT_FORMAT = 1001
}
union tdb_opt_value
{
const void* ptr;
uint64_t value;
}
struct tdb_event
{
align(1):
uint64_t timestamp;
uint64_t num_items;
tdb_item[0] items;
}
extern(C):
void* tdb_cons_init();
tdb_error tdb_cons_open(void* cons,
const char* root,
const char** ofield_names,
uint64_t num_ofields);
void tdb_cons_close(void* cons);
tdb_error tdb_cons_set_opt(void* cons,
tdb_opt_key key,
tdb_opt_value value);
tdb_error tdb_cons_get_opt(void* cons,
tdb_opt_key key,
tdb_opt_value* value);
tdb_error tdb_cons_add(void* cons,
ref const uint8_t[16] uuid,
const uint64_t timestamp,
const char** values,
const uint64_t* value_lengths);
tdb_error tdb_cons_append(void* cons, const void* db);
tdb_error tdb_cons_finalize(void* cons);
tdb_error tdb_uuid_raw(ref const uint8_t[32] hexuuid, ref uint8_t[16] uuid);
void tdb_uuid_hex(ref const uint8_t[16] uuid, ref uint8_t[32] hexuuid);
void* tdb_init();
tdb_error tdb_open(void* db, const char* root);
void tdb_close(void* db);
void tdb_dontneed(const void* db);
void tdb_willneed(const void* db);
tdb_error tdb_set_opt(void* tdb, tdb_opt_key key, tdb_opt_value value);
tdb_error tdb_set_opt(void* tdb, tdb_opt_key key, tdb_opt_value* value);
uint64_t tdb_lexicon_size(const void* db, tdb_field field);
tdb_error tdb_get_field(const void* db, const char* field_name, tdb_field* field);
char* tdb_get_field_name(const void* db, tdb_field field);
tdb_item tdb_get_item(const void* db,
tdb_field field,
const char* value,
uint64_t value_length);
char* tdb_get_value(const void* db,
tdb_field field,
tdb_val val,
uint64_t* value_length);
char* tdb_get_item_value(const void* db,
tdb_item item,
uint64_t* value_length);
uint8_t* tdb_get_uuid(const void* db, uint64_t trail_id);
tdb_error tdb_get_trail_id(const void* db,
ref const uint8_t[16] uuid,
uint64_t* traild_id);
char* tdb_error_str(tdb_error errcode);
uint64_t tdb_num_trails(const void* db);
uint64_t tdb_num_events(const void* db);
uint64_t tdb_num_fields(const void* db);
uint64_t tdb_min_timestamp(const void* db);
uint64_t tdb_max_timestamp(const void* db);
uint64_t tdb_version(const void* db);
void* tdb_cursor_new(const void* db);
void tdb_cursor_free(void* cursor);
tdb_error tdb_get_trail(void* cursor, uint64_t trail_id);
uint64_t tdb_get_trail_length(void* cursor);
tdb_event* tdb_cursor_next(void* cursor);