changelog shortlog graph tags branches changeset files revisions annotate raw help

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

changeset 598: c7f9bfc9570f
parent: ab579a19f4ef
child: fea71448569b
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 16 Aug 2024 15:52:50 -0400
permissions: -rw-r--r--
description: rm duplicate files, add rocksdb batch and logger files
1 ;;; rocksdb/compaction.lisp --- RocksDB Compaction
2 
3 ;; RocksDB Lisp Compaction Filter API
4 
5 ;;; Commentary:
6 
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.
10 
11 ;; ref: https://github.com/facebook/rocksdb/wiki/Compaction-Filter
12 
13 ;;; Code:
14 (in-package :rocksdb)
15 
16 (define-alien-type rocksdb-filter-function
17  (function unsigned-char
18  (* t)
19  int
20  c-string
21  size-t
22  c-string
23  size-t
24  (* (array unsigned-char))
25  (* size-t)
26  (* unsigned-char)))
27 
28 (define-alien-routine rocksdb-compactionfilter-set-ignore-snapshots void
29  (self (* rocksdb-compactionfilter)) (val unsigned-char))
30 
31 (define-alien-routine rocksdb-compactionfilter-destroy void
32  (self (* rocksdb-compactionfilter)))
33 
34 ;;; Compaction Filter Context
35 (define-alien-routine rocksdb-compactionfiltercontext-is-full-compaction unsigned-char
36  (context (* rocksdb-compactionfiltercontext)))
37 
38 (define-alien-routine rocksdb-compactionfiltercontext-is-manual-compaction unsigned-char
39  (context (* rocksdb-compactionfiltercontext)))
40 
41 ;;; Compaction Filter Factory
42 (define-alien-routine rocksdb-compactionfilter-create (* rocksdb-compactionfilter)
43  (state (* t))
44  (destructor (* t))
45  (create-compaction-filter (* unsigned-char))
46  (context (* rocksdb-compactionfiltercontext)))
47 
48 (define-alien-routine rocksdb-compacitonfilter-destroy void
49  (factory (* rocksdb-compactionfilterfactory)))
50 
51 (define-alien-type rocksdb-create-compaction-filter-function
52  (function (* rocksdb-compactionfilter)
53  (* t)
54  (* rocksdb-compactionfiltercontext)))
55 
56 ;; maybe not possible? test
57 (define-alien-callable rocksdb-create-compaction-filter (* rocksdb-compactionfilter)
58  ((state (* t))
59  (context (* rocksdb-compactionfiltercontext)))
60  (declare (ignore state context)))