changelog shortlog graph tags branches changeset files file revisions raw help

Mercurial > core / annotate lisp/ffi/rocksdb/db.lisp

changeset 93: 17b6d1f39506
parent: 8203bd080c77
child: 01051403700f
author: ellis <ellis@rwest.io>
date: Sun, 10 Dec 2023 23:02:43 -0500
permissions: -rw-r--r--
description: rdb refactor, skel stuff
87
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
1
 (in-package :rocksdb)
93
17b6d1f39506 rdb refactor, skel stuff
ellis <ellis@rwest.io>
parents: 87
diff changeset
2
 
87
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
3
 ;;; DB
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
4
 (def-with-errptr rocksdb-open (* rocksdb)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
5
   (opt (* rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
6
   (name c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
7
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
8
 (define-alien-routine rocksdb-close void 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
9
       (db (* rocksdb)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
10
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
11
 (define-alien-routine rocksdb-cancel-all-background-work void 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
12
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
13
   (wait boolean))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
14
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
15
 (def-with-errptr rocksdb-put 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
16
       void 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
17
       (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
18
      (options (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
19
      (key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
20
      (keylen size-t) 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
21
      (val (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
22
      (vallen size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
23
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
24
 (def-with-errptr rocksdb-get 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
25
   (* char)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
26
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
27
   (options (* rocksdb-readoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
28
   (key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
29
   (keylen size-t) 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
30
   (vallen (* size-t)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
31
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
32
 (def-with-errptr rocksdb-delete 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
33
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
34
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
35
   (options (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
36
   (key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
37
   (keylen size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
38
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
39
 (def-with-errptr rocksdb-merge 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
40
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
41
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
42
   (opt (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
43
   (key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
44
   (keylen size-t)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
45
   (val (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
46
   (vallen size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
47
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
48
 (def-with-errptr rocksdb-merge-cf 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
49
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
50
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
51
   (opt (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
52
   (cf (* rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
53
   (key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
54
   (keylen size-t)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
55
   (val (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
56
   (vallen size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
57
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
58
 (def-with-errptr rocksdb-write 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
59
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
60
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
61
   (opt (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
62
   (batch (* rocksdb-writebatch)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
63
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
64
 (def-with-errptr rocksdb-get-cf 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
65
   (* char)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
66
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
67
   (opt (* rocksdb-readoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
68
   (cf (* rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
69
   (key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
70
   (keylen size-t)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
71
   (vallen (* size-t)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
72
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
73
 (define-alien-routine rocksdb-multi-get void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
74
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
75
   (opt (* rocksdb-readoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
76
   (num-keys size-t)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
77
   (keys-list (array c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
78
   (keys-list-sizes (array size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
79
   (values-list (array c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
80
   (values-list-sizes (array size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
81
   (errs (array rocksdb-errptr)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
82
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
83
 (define-alien-routine rocksdb-multi-get-cf void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
84
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
85
   (opt (* rocksdb-readoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
86
   (cfs (array rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
87
   (num-keys size-t)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
88
   (keys-list (array c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
89
   (keys-list-sizes (array size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
90
   (values-list (array c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
91
   (values-list-sizes (array size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
92
   (errs (array rocksdb-errptr)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
93
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
94
 (define-alien-routine rocksdb-cache-create-lru (* rocksdb) (capacity unsigned-int))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
95
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
96
 (def-with-errptr rocksdb-flush void 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
97
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
98
   (options (* rocksdb-flushoptions)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
99
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
100
 ;;; CF
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
101
 (def-with-errptr rocksdb-create-column-family 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
102
   (* rocksdb-column-family-handle)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
103
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
104
   (column-family-options (* rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
105
   (column-family-name c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
106
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
107
 (def-with-errptr rocksdb-create-column-families 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
108
   (array rocksdb-column-family-handle)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
109
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
110
   (column-family-options (* rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
111
   (num-column-familes int)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
112
   (column-family-names (array c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
113
   (lencfs (* size-t)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
114
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
115
 (define-alien-routine rocksdb-create-column-families-destroy void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
116
   (list (array rocksdb-column-family-handle)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
117
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
118
 (define-alien-routine rocksdb-column-family-handle-destroy void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
119
   (* rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
120
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
121
 (define-alien-routine rocksdb-column-family-handle-get-id unsigned-int
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
122
   (* rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
123
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
124
 (define-alien-routine rocksdb-column-family-handle-get-name c-string
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
125
   (handle (* rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
126
   (name-len (* size-t)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
127
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
128
 (def-with-errptr rocksdb-drop-column-family 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
129
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
130
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
131
   (handle (* rocksdb-column-family-handle)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
132
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
133
 (def-with-errptr rocksdb-open-column-families 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
134
   (* rocksdb)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
135
   (options (* rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
136
   (name c-string)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
137
   (num-column-families int)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
138
   (column-family-names (array c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
139
   (column-family-options (array rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
140
   (column-family-handles (array rocksdb-column-family-handle)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
141
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
142
 (def-with-errptr rocksdb-list-column-families 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
143
   (array c-string)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
144
   (opt (* rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
145
   (name c-string)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
146
   (lencf (* size-t)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
147
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
148
 (define-alien-routine rocksdb-list-column-families-destroy void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
149
   (list (array c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
150
   (len size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
151
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
152
 (def-with-errptr rocksdb-put-cf 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
153
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
154
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
155
   (opt (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
156
   (cf (* rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
157
   (key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
158
   (keylen size-t)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
159
   (val (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
160
   (vallen size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
161
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
162
 (def-with-errptr rocksdb-delete-cf 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
163
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
164
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
165
   (options (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
166
   (cf (* rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
167
   (key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
168
   (keylen size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
169
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
170
 (def-with-errptr rocksdb-delete-range-cf 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
171
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
172
   (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
173
   (options (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
174
   (cf (* rocksdb-column-family-handle))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
175
   (start-key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
176
   (start-key-len size-t)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
177
   (end-key (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
178
   (end-key-len size-t))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
179
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
180
 (def-with-errptr rocksdb-destroy-db void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
181
   (opts (* rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
182
   (path c-string))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
183
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
184
 ;;; Iterators
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
185
 (define-alien-routine rocksdb-create-iterator (* rocksdb-iterator)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
186
       (db (* rocksdb))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
187
       (opt (* rocksdb-readoptions)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
188
 (define-alien-routine rocksdb-iter-destroy void 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
189
       (iter (* rocksdb-iterator)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
190
 (define-alien-routine rocksdb-iter-seek-to-first void 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
191
       (iter (* rocksdb-iterator)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
192
 (define-alien-routine rocksdb-iter-valid boolean 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
193
       (iter (* rocksdb-iterator)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
194
 (define-alien-routine rocksdb-iter-next void 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
195
       (iter (* rocksdb-iterator)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
196
 (define-alien-routine rocksdb-iter-prev void 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
197
       (iter (* rocksdb-iterator)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
198
 (define-alien-routine rocksdb-iter-key (* char)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
199
   (iter (* rocksdb-iterator))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
200
   (klen-ptr (* size-t)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
201
 (define-alien-routine rocksdb-iter-value (* char) 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
202
   (iter (* rocksdb-iterator)) 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
203
   (vlen-ptr (* size-t)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
204
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
205
 ;;; Backup
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
206
 (def-with-errptr rocksdb-backup-engine-open
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
207
   (* rocksdb-backup-engine)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
208
   (opts (* rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
209
   (path (* char)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
210
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
211
 (def-with-errptr rocksdb-backup-engine-create-new-backup
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
212
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
213
   (be (* rocksdb-backup-engine))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
214
   (db (* rocksdb)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
215
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
216
 (def-with-errptr rocksdb-backup-engine-restore-db-from-latest-backup
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
217
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
218
   (be (* rocksdb-backup-engine))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
219
   (db-dir (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
220
   (wal-dir (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
221
   (res-opts (* rocksdb-restore-options)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
222
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
223
 (def-with-errptr rocksdb-backup-engine-restore-db-from-backup
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
224
   void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
225
   (be (* rocksdb-backup-engine))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
226
   (db-dir (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
227
   (wal-dir (* char))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
228
   (res-opts (* rocksdb-restore-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
229
   (backup-id unsigned-int))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
230
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
231
 (define-alien-routine rocksdb-backup-engine-close void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
232
   (be (* rocksdb-backup-engine)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
233
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
234
 ;;; Transactions
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
235
 (define-alien-routine rocksdb-transaction-begin (* rocksdb-transaction)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
236
   (wopts (* rocksdb-writeoptions))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
237
   (topts (* rocksdb-transaction-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
238
   (told (* rocksdb-transaction)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
239
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
240
 (def-with-errptr rocksdb-transactiondb-open
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
241
   (* rocksdb-transactiondb)
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
242
   (opts (* rocksdb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
243
   (topts (* rocksdb-transactiondb-options))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
244
   (name (* char)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
245
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
246
 (define-alien-routine rocksdb-transactiondb-close void
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
247
   (tdb (* rocksdb-transactiondb)))
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
248
 
8203bd080c77 refactoring of ffi/rocksdb, tests
ellis <ellis@rwest.io>
parents:
diff changeset
249
 ;;; BlobDB