Coverage report: /home/ellis/comp/core/ffi/rocksdb/compaction.lisp
Kind | Covered | All | % |
expression | 0 | 27 | 0.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; rocksdb/compaction.lisp --- RocksDB Compaction
3
;; RocksDB Lisp Compaction Filter API
7
;; compaction filters are like custom GC rules for the database. compactions
8
;; run in the background and can be configured via the column-family-options
9
;; or compactionfilterfactory API.
11
;; ref: https://github.com/facebook/rocksdb/wiki/Compaction-Filter
14
* RocksDB snapshots do not guarantee to preserve the state of the DB in the
15
presence of CompactionFilter. Data seen from a snapshot might disappear after
16
a table file created with a `CompactionFilter` is installed. If you use
17
snapshots, think twice about whether you want to use `CompactionFilter` and
18
whether you are using it in a safe way.
20
* If multithreaded compaction is being used *and* a single CompactionFilter
21
instance was supplied via Options::compaction_filter, CompactionFilter
22
methods may be called from different threads concurrently. The application
23
must ensure that such calls are thread-safe. If the CompactionFilter was
24
created by a factory, then it will only ever be used by a single thread that
25
is doing the table file creation, and this call does not need to be
26
thread-safe. However, multiple filters may be in existence and operating
29
* The key passed to the filtering methods includes the timestamp if
30
user-defined timestamps are enabled.
32
* Exceptions MUST NOT propagate out of overridden functions into RocksDB,
33
because RocksDB is not exception-safe. This could cause undefined behavior
34
including data loss, unreported corruption, deadlocks, and more.
39
(define-alien-type rocksdb-filter-function
40
(function unsigned-char
47
(* (array unsigned-char))
51
(define-alien-type rocksdb-create-compaction-filter-function
52
(function (* rocksdb-compactionfilter)
54
(* rocksdb-compactionfiltercontext)))
56
(defar rocksdb-compactionfilter-create (* rocksdb-compactionfilter)
58
(destructor (* rocksdb-destructor-function))
59
(filter (* rocksdb-filter-function))
60
(name (* rocksdb-name-function)))
62
(defar rocksdb-compactionfilter-set-ignore-snapshots void
63
(self (* rocksdb-compactionfilter)) (val unsigned-char))
65
(defar rocksdb-compactionfilter-destroy void
66
(self (* rocksdb-compactionfilter)))
68
;;; Compaction Filter Context
69
(defar rocksdb-compactionfiltercontext-is-full-compaction unsigned-char
70
(context (* rocksdb-compactionfiltercontext)))
72
(defar rocksdb-compactionfiltercontext-is-manual-compaction unsigned-char
73
(context (* rocksdb-compactionfiltercontext)))
75
;;; Compaction Filter Factory
76
(defar rocksdb-compactionfilterfactory-create (* rocksdb-compactionfilterfactory)
78
(destructor (* rocksdb-destructor-function))
79
(creator (* rocksdb-create-compaction-filter-function))
80
(name (* rocksdb-name-function)))
82
(defar rocksdb-compacitonfilterfactory-destroy void
83
(factory (* rocksdb-compactionfilterfactory)))
85
(define-alien-callable rocksdb-filter-never unsigned-char
88
(key (array unsigned-char))
90
(existing-val (array unsigned-char))
91
(existing-val-length size-t)
92
(new-val (* (array unsigned-char)))
93
(new-val-length (* size-t))
94
(value-changed (* unsigned-char)))
95
(declare (ignore state level key key-length existing-val existing-val-length new-val new-val-length value-changed))
98
(define-alien-callable rocksdb-filter-never-name c-string () (make-alien-string "cc:never"))
100
(define-alien-callable rocksdb-create-compaction-filter-never (* rocksdb-compactionfilter)
102
(context (* rocksdb-compactionfiltercontext)))
103
(rocksdb-compactionfilter-create
105
(alien-sap (alien-callable-function 'rocksdb-destructor))
106
(alien-sap (alien-callable-function 'rocksdb-filter-never))
107
(alien-sap (alien-callable-function 'rocksdb-filter-never-name))))