forked from wuxb45/wormhole
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlite.h
97 lines (69 loc) · 2.35 KB
/
lite.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
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
/*
* Copyright (c) 2016--2021 Wu, Xingbo <[email protected]>
*
* All rights reserved. No warranty, explicit or implicit, provided.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct litemap;
struct literef;
// litemap {{{
// the wh created by litemap_create() can work with all of safe/unsafe operations.
extern struct litemap *
litemap_create(const struct kvmap_mm * const mm);
extern struct kv *
litemap_get(struct literef * const ref, const struct kref * const key, struct kv * const out);
extern bool
litemap_probe(struct literef * const ref, const struct kref * const key);
extern bool
litemap_put(struct literef * const ref, struct kv * const kv);
extern bool
litemap_del(struct literef * const ref, const struct kref * const key);
extern struct litemap_iter *
litemap_iter_create(struct literef * const ref);
extern void
litemap_iter_seek(struct litemap_iter * const iter, const struct kref * const key);
extern bool
litemap_iter_valid(struct litemap_iter * const iter);
extern struct kv *
litemap_iter_peek(struct litemap_iter * const iter, struct kv * const out);
extern bool
litemap_iter_kref(struct litemap_iter * const iter, struct kref * const kref);
extern bool
litemap_iter_kvref(struct litemap_iter * const iter, struct kvref * const kvref);
extern void
litemap_iter_skip1(struct litemap_iter * const iter);
extern void
litemap_iter_skip(struct litemap_iter * const iter, const u32 nr);
extern struct kv *
litemap_iter_next(struct litemap_iter * const iter, struct kv * const out);
extern bool
litemap_iter_inp(struct litemap_iter * const iter, kv_inp_func uf, void * const priv);
extern void
litemap_iter_park(struct litemap_iter * const iter);
extern void
litemap_iter_destroy(struct litemap_iter * const iter);
extern struct literef *
litemap_ref(struct litemap * const map);
extern struct litemap *
litemap_unref(struct literef * const ref);
extern void
litemap_park(struct literef * const ref);
extern void
litemap_resume(struct literef * const ref);
extern void
litemap_refresh_qstate(struct literef * const ref);
// clean with more threads
extern void
litemap_clean_th(struct litemap * const map, const u32 nr_threads);
extern void
litemap_clean(struct litemap * const map);
extern void
litemap_destroy(struct litemap * const map);
// }}} litemap
#ifdef __cplusplus
}
#endif
// vim:fdm=marker