-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathht.h
More file actions
226 lines (155 loc) · 5.53 KB
/
ht.h
File metadata and controls
226 lines (155 loc) · 5.53 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*
* Copyright (c) 2016--2021 Wu, Xingbo <wuxb45@gmail.com>
*
* All rights reserved. No warranty, explicit or implicit, provided.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
// nullmap {{{
extern void *
nullmap_create(const struct kvmap_mm * const mm);
extern struct kv *
nullmap_get(void * const map, const struct kref * const key, struct kv * const out);
extern bool
nullmap_probe(void * const map, const struct kref * const key);
extern bool
nullmap_put(void * const map, struct kv * const kv);
extern bool
nullmap_del(void * const map, const struct kref * const key);
extern bool
nullmap_inp(void * const map, const struct kref * const key,
kv_inp_func uf, void * const priv);
extern bool
nullmap_merge(void * const map, const struct kref * const key, kv_merge_func uf, void * const priv);
extern u64
nullmap_delr(void * const map, const struct kref * const start, const struct kref * const end);
extern void
nullmap_clean(void * const map);
extern void
nullmap_destroy(void * const map);
extern void
nullmap_fprint(void * const map, FILE * const out);
extern void *
nullmap_iter_create(void * const map);
extern void
nullmap_iter_seek(void * const iter, const struct kref * const key);
extern bool
nullmap_iter_valid(void * const iter);
extern struct kv *
nullmap_iter_peek(void * const iter, struct kv * const out);
extern void
nullmap_iter_skip(void * const iter, const u32 nr);
extern struct kv *
nullmap_iter_next(void * const iter, struct kv * const out);
extern bool
nullmap_iter_inp(void * const iter, kv_inp_func uf, void * const priv);
extern void
nullmap_iter_destroy(void * const iter);
extern const struct kvmap_api kvmap_api_nullmap;
// }}} nullmap
// kvmap2 {{{
struct kvmap2;
extern struct kvmap2 *
kvmap2_create(const struct kvmap_mm * const mm);
extern struct kv *
kvmap2_get(struct kvmap2 * const map2, const struct kref * const key, struct kv * const out);
extern bool
kvmap2_probe(struct kvmap2 * const map2, const struct kref * const key);
extern bool
kvmap2_put(struct kvmap2 * const map2, struct kv * const kv);
extern bool
kvmap2_del(struct kvmap2 * const map2, const struct kref * const key);
extern bool
kvmap2_inp(struct kvmap2 * const map2, const struct kref * const key,
kv_inp_func uf, void * const priv);
extern bool
kvmap2_locking(struct kvmap2 * const map2, const bool locking);
extern void
kvmap2_clean(struct kvmap2 * const map2);
extern void
kvmap2_destroy(struct kvmap2 * const map2);
extern void
kvmap2_fprint(struct kvmap2 * const map2, FILE * const out);
struct kvmap2_iter;
extern struct kvmap2_iter *
kvmap2_iter_create(struct kvmap2 * const map2);
extern struct kv *
kvmap2_iter_next(struct kvmap2_iter * const iter2, struct kv * const out);
extern void
kvmap2_iter_destroy(struct kvmap2_iter * const iter2);
extern const struct kvmap_api kvmap_api_kvmap2;
// }}} kvmap2
// cuckoo {{{
struct cuckoo;
extern struct cuckoo *
cuckoo_create(const struct kvmap_mm * const mm, const u64 nr_cuckoo);
extern struct cuckoo *
cuckoo2_create(const struct kvmap_mm * const mm);
extern struct kv *
cuckoo_get(struct cuckoo * const map, const struct kref * const key, struct kv * const out);
extern bool
cuckoo_probe(struct cuckoo * const map, const struct kref * const key);
extern bool
cuckoo_put(struct cuckoo * const map, struct kv * const kv);
extern bool
cuckoo_del(struct cuckoo * const map, const struct kref * const key);
extern bool
cuckoo_inp(struct cuckoo * const map, const struct kref * const key,
kv_inp_func uf, void * const priv);
extern bool
cuckoo_locking(struct cuckoo * const map, const bool v);
extern void
cuckoo_clean(struct cuckoo * const map);
extern void
cuckoo_destroy(struct cuckoo * const map);
extern void
cuckoo_fprint(struct cuckoo * const map, FILE * const out);
extern struct cuckoo_iter *
cuckoo_iter_create(struct cuckoo * const map);
extern struct kv *
cuckoo_iter_next(struct cuckoo_iter * const iter, struct kv * const out);
extern void
cuckoo_iter_destroy(struct cuckoo_iter * const iter);
extern const struct kvmap_api kvmap_api_cuckoo;
// }}} cuckoo
// chainmap {{{
struct chainmap;
extern struct chainmap *
chainmap_create(const struct kvmap_mm * const mm);
extern struct kv *
chainmap_get(struct chainmap * const map, const struct kref * const key, struct kv * const out);
extern bool
chainmap_probe(struct chainmap * const map, const struct kref * const key);
extern bool
chainmap_put(struct chainmap * const map, struct kv * const kv);
extern bool
chainmap_del(struct chainmap * const map, const struct kref * const key);
extern bool
chainmap_inp(struct chainmap * const map, const struct kref * const key,
kv_inp_func uf, void * const priv);
extern bool
chainmap_locking(struct chainmap * const map, const bool locking);
extern void
chainmap_clean(struct chainmap * const map);
extern void
chainmap_destroy(struct chainmap * const map);
extern void
chainmap_fprint(struct chainmap * const map, FILE * const out);
extern struct chainmap_iter *
chainmap_iter_create(struct chainmap * const map);
extern struct kv *
chainmap_iter_peek(struct chainmap_iter * const iter, struct kv * const out);
extern void
chainmap_iter_skip(struct chainmap_iter * const iter, const u32 nr);
extern struct kv *
chainmap_iter_next(struct chainmap_iter * const iter, struct kv * const out);
extern void
chainmap_iter_destroy(struct chainmap_iter * const iter);
extern const struct kvmap_api kvmap_api_chainmap;
// }}} chainmap
#ifdef __cplusplus
}
#endif
// vim:fdm=marker