Mercurial > core / lisp/ffi/rocksdb/compaction.lisp
changeset 611: |
57813b8ee029 |
parent: |
6fc04c4d465c
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Mon, 19 Aug 2024 19:25:55 -0400 |
permissions: |
-rw-r--r-- |
description: |
more rocksdb work, slice -> slicetransform |
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 (define-alien-routine rocksdb-compactionfilter-create (* rocksdb-compactionfilter) 58 (destructor (* rocksdb-destructor-function)) 59 (filter (* rocksdb-filter-function)) 60 (name (* rocksdb-name-function))) 62 (define-alien-routine rocksdb-compactionfilter-set-ignore-snapshots void 63 (self (* rocksdb-compactionfilter)) (val unsigned-char)) 65 (define-alien-routine rocksdb-compactionfilter-destroy void 66 (self (* rocksdb-compactionfilter))) 68 ;;; Compaction Filter Context 69 (define-alien-routine rocksdb-compactionfiltercontext-is-full-compaction unsigned-char 70 (context (* rocksdb-compactionfiltercontext))) 72 (define-alien-routine rocksdb-compactionfiltercontext-is-manual-compaction unsigned-char 73 (context (* rocksdb-compactionfiltercontext))) 75 ;;; Compaction Filter Factory 76 (define-alien-routine rocksdb-compactionfilterfactory-create (* rocksdb-compactionfilterfactory) 78 (destructor (* rocksdb-destructor-function)) 79 (creator (* rocksdb-create-compaction-filter-function)) 80 (name (* rocksdb-name-function))) 82 (define-alien-routine 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-create-compaction-filter-never (* rocksdb-compactionfilter) 100 (context (* rocksdb-compactionfiltercontext))) 101 (rocksdb-compactionfilter-create 103 (alien-sap (alien-callable-function 'rocksdb-destructor)) 104 (alien-sap (alien-callable-function 'rocksdb-filter-never))