This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
forked from linxGnu/grocksdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grocksdb.c
65 lines (53 loc) · 2.66 KB
/
grocksdb.c
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
#include "grocksdb.h"
#include "_cgo_export.h"
/* Base */
void grocksdb_destruct_handler(void* state) { }
/* Comparator */
rocksdb_comparator_t* grocksdb_comparator_create(uintptr_t idx) {
return rocksdb_comparator_create(
(void*)idx,
grocksdb_destruct_handler,
(int (*)(void*, const char*, size_t, const char*, size_t))(grocksdb_comparator_compare),
(const char *(*)(void*))(grocksdb_comparator_name));
}
rocksdb_comparator_t* grocksdb_comparator_with_ts_create(uintptr_t idx, size_t ts_size) {
return rocksdb_comparator_with_ts_create(
(void*)idx,
grocksdb_destruct_handler,
(int (*)(void*, const char*, size_t, const char*, size_t))(grocksdb_comparator_compare),
(int (*)(void*, const char*, size_t, const char*, size_t))(grocksdb_comparator_compare_ts),
(int (*)(void*, const char*, size_t, unsigned char, const char*, size_t, unsigned char))(grocksdb_comparator_compare_without_ts),
(const char* (*)(void*))(grocksdb_comparator_name),
ts_size);
}
/* CompactionFilter */
rocksdb_compactionfilter_t* grocksdb_compactionfilter_create(uintptr_t idx) {
return rocksdb_compactionfilter_create(
(void*)idx,
grocksdb_destruct_handler,
(unsigned char (*)(void*, int, const char*, size_t, const char*, size_t, char**, size_t*, unsigned char*))(grocksdb_compactionfilter_filter),
(const char *(*)(void*))(grocksdb_compactionfilter_name));
}
/* Merge Operator */
rocksdb_mergeoperator_t* grocksdb_mergeoperator_create(uintptr_t idx) {
return rocksdb_mergeoperator_create(
(void*)idx,
grocksdb_destruct_handler,
(char* (*)(void*, const char*, size_t, const char*, size_t, const char* const*, const size_t*, int, unsigned char*, size_t*))(grocksdb_mergeoperator_full_merge),
(char* (*)(void*, const char*, size_t, const char* const*, const size_t*, int, unsigned char*, size_t*))(grocksdb_mergeoperator_partial_merge_multi),
grocksdb_mergeoperator_delete_value,
(const char* (*)(void*))(grocksdb_mergeoperator_name));
}
void grocksdb_mergeoperator_delete_value(void* id, const char* v, size_t s) {
free((char*)v);
}
/* Slice Transform */
rocksdb_slicetransform_t* grocksdb_slicetransform_create(uintptr_t idx) {
return rocksdb_slicetransform_create(
(void*)idx,
grocksdb_destruct_handler,
(char* (*)(void*, const char*, size_t, size_t*))(grocksdb_slicetransform_transform),
(unsigned char (*)(void*, const char*, size_t))(grocksdb_slicetransform_in_domain),
(unsigned char (*)(void*, const char*, size_t))(grocksdb_slicetransform_in_range),
(const char* (*)(void*))(grocksdb_slicetransform_name));
}