changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/ffi/rocksdb/pkg.lisp

changeset 698: 96958d3eb5b0
parent: 12287fab15d0
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 ;;; rocksdb.lisp --- low-level bindings to the RocksDB C API
2 
3 ;; for the high-level interface, see rdb.lisp.
4 
5 ;;; Commentary:
6 
7 ;; if ur on archlinux and installed rocksdb via AUR you may receive an error from
8 ;; jemalloc: cannot allocate memory in static TLS block:
9 
10 ;; https://github.com/veer66/cl-rocksdb/issues/1
11 
12 ;; for best results, you should compile rocksdb from source - use j0ni's snippet as a
13 ;; starting point.
14 
15 ;; make shared_lib DISABLE_JEMALLOC=1 &&
16 ;; sudo cp librocksdb.so.* /usr/local/lib/ &&
17 ;; sudo cp -rf include/* /usr/local/include/
18 
19 ;; https://github.com/facebook/rocksdb/blob/main/Makefile
20 
21 ;; check /usr/local/include/rocksdb/c.h for the C API header, the source is under
22 ;; db/c.cc
23 
24 ;; here are some important notes to keepin mind (from the API header):
25 #|
26 C bindings for rocksdb. May be useful as a stable ABI that can be
27 used by programs that keep rocksdb in a shared library, or for
28 a JNI api.
29 
30 Does not support:
31 . getters for the option types
32 . custom comparators that implement key shortening
33 . capturing post-write-snapshot
34 . custom iter, db, env, cache implementations using just the C bindings
35 
36 Some conventions:
37 
38 (1) We expose just opaque struct pointers and functions to clients.
39 This allows us to change internal representations without having to
40 recompile clients.
41 
42 (2) For simplicity, there is no equivalent to the Slice type. Instead,
43 the caller has to pass the pointer and length as separate
44 arguments.
45 
46 (3) Errors are represented by a null-terminated c string. NULL
47 means no error. All operations that can raise an error are passed
48 a "char** errptr" as the last argument. One of the following must
49 be true on entry:
50 *errptr == NULL
51 *errptr points to a malloc()ed null-terminated error message
52 On success, a leveldb routine leaves *errptr unchanged.
53 On failure, leveldb frees the old value of *errptr and
54 set *errptr to a malloc()ed error message.
55 
56 (4) Bools have the type unsigned char (0 == false; rest == true)
57 
58 (5) All of the pointer arguments must be non-NULL.|#
59 
60 ;;; Code:
61 (defpackage :rocksdb
62  (:use :cl :std/alien :std/sym :std/macs :sb-alien)
63  (:export
64  ;; vars
65  :*rocksdb-options*
66  :*rocksdb-compaction-levels*
67  :*rocksdb-compression-backends*
68  :rocksdb-compression-backend
69  :*rocksdb-perf-metrics*
70  :*rocksdb-perf-levels*
71  :*rocksdb-statistics-levels*
72  :rocksdb-statistics-level
73  :rocksdb-perf-level
74  :*rocksdb-column-family-metadata*
75  :*rocksdb-level-metadata*
76  :*rocksdb-sst-file-metadata*
77  :*rocksdb-properties*
78  :rocksdb-num-files-at-level
79  :rocksdb-compression-ratio-at-level
80  :rocksdb-aggregated-table-properties-at-level
81  :rocksdb-concat-partial-merge
82  :rocksdb-concat-full-merge
83  :rocksdb-name
84  :rocksdb-concat-delete-value
85  :rocksdb-destructor
86  :rocksdb-slicetransform-create
87  :rocksdb-slicetransform-create-noop
88  :rocksdb-slicetransform-destroy
89  :rocksdb-slicetransform-create-fixed-prefix
90  :rocksdb-ingestexternalfileoptions-set-move-files
91  :rocksdb-ingestexternalfileoptions-set-snapshot-consistency
92  :rocksdb-ingestexternalfileoptions-set-allow-global-seqno
93  :rocksdb-ingestexternalfileoptions-set-allow-blocking-flush
94  :rocksdb-ingestexternalfileoptions-set-ingest-behind
95  :rocksdb-ingestexternalfileoptions-set-fail-if-not-bottommost-level
96  :rocksdb-backup-engine-options-set-backup-dir
97  :rocksdb-restore-options-set-keep-log-files
98  :rocksdb-hyper-clock-cache-options-set-estimated-entry-charge
99  :rocksdb-backup-engine-options-set-env
100  :rocksdb-hyper-clock-cache-options-set-capacity
101  :rocksdb-hyper-clock-cache-options-set-num-shard-bits
102  :rocksdb-hyper-clock-cache-options-set-memory-allocator
103  :rocksdb-wal-readoptions
104  :rocksdb-block-based-options-create
105  :rocksdb-block-based-options-set-top-level-index-pinning-tier
106  :rocksdb-block-based-options-set-partition-pinning-tier
107  :rocksdb-block-based-options-set-unpartition-pinning-tier
108  :rocksdb-block-based-options-destroy
109  :rocksdb-options-increase-parallelism
110  :rocksdb-options-set-uint64add-merge-operator
111  :rocksdb-options-enable-statistics
112  :rocksdb-options-set-db-paths
113  :rocksdb-options-set-env
114  :rocksdb-options-statistics-get-ticker-count
115  :rocksdb-options-set-plain-table-factory
116  :rocksdb-options-prepare-for-bulk-load
117  :rocksdb-options-set-ratelimiter
118  :rocksdb-options-optimize-level-style-compaction
119  :rocksdb-options-set-compression-per-level
120  :rocksdb-options-statistics-get-string
121  :rocksdb-options-set-cf-paths
122  :rocksdb-options-set-info-log
123  :rocksdb-options-statistics-get-histogram-data
124  :rocksdb-options-set-min-level-to-compress
125  :rocksdb-options-set-universal-compaction-options
126  :rocksdb-options-set-row-cache
127  :rocksdb-load-latest-options-destroy
128  :rocksdb-options-create-copy
129  :rocksdb-options-set-parallelism
130  :rocksdb-options-set-prepare-for-bulk-load
131  :rocksdb-options-set-enable-statistics
132  :rocksdb-close
133  :rocksdb-enable-manual-compaction
134  :rocksdb-cancel-all-background-work
135  :rocksdb-disable-manual-compaction
136  :rocksdb-multi-get
137  :rocksdb-multi-get-with-ts
138  :rocksdb-multi-get-cf
139  :rocksdb-multi-get-cf-with-ts
140  :rocksdb-cache-create-lru
141  :rocksdb-delete-file
142  :rocksdb-livefile
143  :rocksdb-property-value
144  :rocksdb-property-value-cf
145  :rocksdb-property-int
146  :rocksdb-property-int-cf
147  :rocksdb-create-column-families-destroy
148  :rocksdb-column-family-handle-get-id
149  :rocksdb-column-family-handle-destroy
150  :rocksdb-column-family-handle-get-name
151  :rocksdb-list-column-families-destroy
152  :rocksdb-create-iterator
153  :rocksdb-iter-seek-to-last
154  :rocksdb-iter-next
155  :rocksdb-iter-timestamp
156  :rocksdb-wal-iter-get-batch
157  :rocksdb-iter-destroy
158  :rocksdb-iter-seek
159  :rocksdb-iter-prev
160  :rocksdb-iter-get-error
161  :rocksdb-get-latest-sequence-number
162  :rocksdb-iter-seek-to-first
163  :rocksdb-iter-seek-for-prev
164  :rocksdb-iter-value
165  :rocksdb-wal-iter-next
166  :rocksdb-wal-iter-destroy
167  :rocksdb-iter-valid
168  :rocksdb-create-iterator-cf
169  :rocksdb-wal-iter-valid
170  :rocksdb-backup-engine-close
171  :rocksdb-transaction-begin
172  :rocksdb-transactiondb-release-snapshot
173  :rocksdb-transactiondb-property-int
174  :rocksdb-transactiondb-get-close-db
175  :rocksdb-transaction-set-savepoint
176  :rocksdb-transaction-create-iterator
177  :rocksdb-transactiondb-create-iterator
178  :rocksdb-optimistictransactiondb-get-base-db
179  :rocksdb-optimistictransaction-begin
180  :rocksdb-transactiondb-flush-wal
181  :rocksdb-transaction-close
182  :rocksdb-transactiondb-property-value
183  :rocksdb-transactiondb-get-base-db
184  :rocksdb-transaction-get-name
185  :rocksdb-transaction-destroy
186  :rocksdb-transaction-create-iterator-cf
187  :rocksdb-transactiondb-create-iterator-cf
188  :rocksdb-optimistictransactiondb-close-base-db
189  :rocksdb-optimistictransactiondb-close
190  :rocksdb-transactiondb-create-snapshot
191  :rocksdb-perfcontext-reset
192  :rocksdb-perfcontext-metric
193  :rocksdb-perfcontext-report
194  :rocksdb-perfcontext-destroy
195  :rocksdb-set-perf-level
196  :rocksdb-filterpolicy-destroy
197  :rocksdb-filterpolicy-create-ribbon
198  :rocksdb-filterpolicy-create-bloom
199  :rocksdb-filterpolicy-create-ribbon-hybrid
200  :rocksdb-filterpolicy-create-bloom-full
201  :rocksdb-create-snapshot
202  :rocksdb-snapshot-get-sequence-number
203  :rocksdb-release-snapshot
204  :rocksdb-errptr
205  :rocksdb-sstfilewriter-create
206  :rocksdb-sstfilewriter-destroy
207  :rocksdb-sstfilewriter-create-with-comparator
208  :rocksdb-statistics-histogram-data-create
209  :rocksdb-statistics-histogram-data-get-median
210  :rocksdb-statistics-histogram-data-get-p99
211  :rocksdb-statistics-histogram-data-get-std-dev
212  :rocksdb-statistics-histogram-data-get-count
213  :rocksdb-statistics-histogram-data-get-min
214  :rocksdb-statistics-histogram-data-destroy
215  :rocksdb-statistics-histogram-data-get-p95
216  :rocksdb-statistics-histogram-data-get-average
217  :rocksdb-statistics-histogram-data-get-max
218  :rocksdb-statistics-histogram-data-get-sum
219  :rocksdb-mergeoperator-create
220  :rocksdb-full-merge-function
221  :rocksdb-delete-value-function
222  :rocksdb-mergeoperator-destroy
223  :rocksdb-partial-merge-function
224  :rocksdb-destructor-function
225  :rocksdb-get-column-family-metadata
226  :rocksdb-column-family-metadata-destroy
227  :rocksdb-column-family-metadata-get-file-count
228  :rocksdb-column-family-metadata-get-level-count
229  :rocksdb-level-metadata-destroy
230  :rocksdb-level-metadata-get-size
231  :rocksdb-level-metadata-get-sst-file-metadata
232  :rocksdb-sst-file-metadata-get-relative-filename
233  :rocksdb-sst-file-metadata-get-size
234  :rocksdb-sst-file-metadata-get-largestkey
235  :rocksdb-get-column-family-metadata-cf
236  :rocksdb-column-family-metadata-get-size
237  :rocksdb-column-family-metadata-get-name
238  :rocksdb-column-family-metadata-get-level-metadata
239  :rocksdb-level-metadata-get-level
240  :rocksdb-level-metadata-get-file-count
241  :rocksdb-sst-file-metadata-destroy
242  :rocksdb-sst-file-metadata-get-directory
243  :rocksdb-sst-file-metadata-get-smallestkey
244  :rocksdb-compactionfilter-set-ignore-snapshots
245  :rocksdb-compactionfiltercontext-is-full-compaction
246  :rocksdb-compactionfilter-destroy
247  :rocksdb-compactionfiltercontext-is-manual-compaction
248  :rocksdb-compactionfilter-create
249  :rocksdb-comparator-destroy
250  :rocksdb-comparator-create
251  :rocksdb-comparator-with-ts-create
252  :rocksdb-checkpoint-object-destroy
253  :rocksdb-name-function
254  :rocksdb-concat-merge-name
255  :rocksdb-compare-never-without-ts
256  :rocksdb-compare-never-with-ts
257  :rocksdb-compare-never-name
258  :rocksdb-compare-never
259  :rocksdb-compare-without-ts-function
260  :rocksdb-compare-with-ts-function
261  :rocksdb-compare-function
262  :rocksdb-create-compaction-filter
263  :rocksdb-create-compaction-filter-function
264  :rocksdb-get-default-column-family-handle
265  :rocksdb-get-db-identity
266  :rocksdb-batched-multi-get-cf
267  :rocksdb-key-may-exist
268  :rocksdb-key-may-exist-cf
269  :rocksdb-backup-engine-get-backup-info
270  :rocksdb-backup-engine-info-count
271  :rocksdb-backup-engine-info-timestamp
272  :rocksdb-backup-engine-info-backup-id
273  :rocksdb-backup-engine-info-size
274  :rocksdb-backup-engine-info-num-files
275  :rocksdb-backup-engine-info-destroy
276  :rocksdb-iter-key
277  :rocksdb-get-updates-since
278  :rocksdb-create-iterators
279  :rocksdb-create-compaction-filter-never
280  :rocksdb-compacitonfilterfactory-destroy
281  :rocksdb-compactionfilterfactory-create
282  :rocksdb-filter-never
283  :rocksdb-delete-value
284  :define-merge-operator
285  :*rocksdb-partial-merge-lambda-list*
286  :*rocksdb-full-merge-lambda-list*
287  :define-partial-merge-op
288  :define-full-merge-op
289  :rocksdb-logger-destroy
290  :rocksdb-log-function
291  :rocksdb-logger-create-callback-logger
292  :rocksdb-log-default
293  :rocksdb-logger-create-stderr-logger
294  :rocksdb-writebatch-create
295  :rocksdb-writebatch-create-from
296  :rocksdb-writebatch-create-with-params
297  :rocksdb-writebatch-destroy
298  :rocksdb-writebatch-delete-cf-with-ts
299  :rocksdb-writebatch-delete-cf
300  :rocksdb-writebatch-delete
301  :rocksdb-writebatch-putv-cf
302  :rocksdb-writebatch-putv
303  :rocksdb-writebatch-put-cf-with-ts
304  :rocksdb-writebatch-put-cf
305  :rocksdb-writebatch-put
306  :rocksdb-writebatch-count
307  :rocksdb-writebatch-clear
308  :rocksdb-writebatch-wi-create-with-params
309  :rocksdb-writebatch-wi-create-from
310  :rocksdb-writebatch-wi-create
311  :rocksdb-transform-function
312  :rocksdb-in-domain-function
313  :rocksdb-in-range-function
314  :rocksdb-mergeoperator-function
315  :rocksdb-logger-function
316  :rocksdb-compactionfilter-function
317  :rocksdb-comparator-function
318  :rocksdb-get-ts-size-function
319  :rocksdb-merge-cf-function
320  :rocksdb-deleted-cf-function
321  :rocksdb-put-cf-function
322  :rocksdb-deleted-function
323  :rocksdb-put-function
324  :rocksdb-open-column-families
325  :rocksdb-create-default-env
326  :rocksdb-create-mem-env
327  :rocksdb-env-set-background-threads
328  :rocksdb-env-get-background-threads
329  :rocksdb-env-destroy
330  :rocksdb-create-dir-if-missing
331  :rocksdb-options-set-wal-dir))
332 
333 (in-package :rocksdb)
334 
335 (define-alien-loader "rocksdb" t)