Coverage report: /home/ellis/comp/core/ffi/rocksdb/comparator.lisp

KindCoveredAll%
expression016 0.0
branch00nil
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; rocksdb/comparator.lisp --- RocksDB Comparators
2
 
3
 ;; RocksDB Lisp Comparator API
4
 
5
 ;;; Commentary:
6
 
7
 ;; ref: https://github.com/facebook/rocksdb/blob/main/include/rocksdb/comparator.h
8
 
9
 #|
10
 Three-way comparison.  Returns value:
11
   < 0 iff "a" < "b",
12
   == 0 iff "a" == "b",
13
   > 0 iff "a" > "b"
14
 Note that Compare(a, b) also compares timestamp if timestamp size is
15
 non-zero. For the same user key with different timestamps, larger (newer)
16
 timestamp comes first.
17
 |#
18
 
19
 ;;; Code:
20
 (in-package :rocksdb)
21
 
22
 (define-alien-type rocksdb-compare-function
23
   (function int
24
             (* t)
25
             (* unsigned-char)
26
             size-t
27
             (* unsigned-char)
28
             size-t))
29
 
30
 (define-alien-type rocksdb-compare-ts-function
31
   (function int
32
             (* t)
33
             (* unsigned-char)
34
             size-t
35
             (* unsigned-char)
36
             size-t))
37
 
38
 (define-alien-type rocksdb-compare-without-ts-function
39
   (function int
40
             (* t)
41
             (* unsigned-char)
42
             size-t
43
             unsigned-char
44
             (* unsigned-char)
45
             size-t
46
             unsigned-char))
47
 
48
 (defar rocksdb-comparator-create (* rocksdb-comparator)
49
   (state (* t))
50
   (destructor (* rocksdb-destructor-function))
51
   (compare (* rocksdb-compare-function))
52
   (name (* rocksdb-name-function)))
53
 
54
 (defar rocksdb-comparator-destroy void (self (* rocksdb-comparator)))
55
 
56
 (defar rocksdb-comparator-with-ts-create (* rocksdb-comparator)
57
   (state (* t))
58
   (destructor (* rocksdb-destructor-function))
59
   (compare (* rocksdb-compare-function))
60
   (compare-ts (* rocksdb-compare-ts-function))
61
   (compare-without-ts (* rocksdb-compare-without-ts-function))
62
   (name (* rocksdb-name-function)))
63
 
64
 (define-alien-callable rocksdb-compare-never-name c-string () (make-alien-string "compare-never"))
65
 
66
 (define-alien-callable rocksdb-compare-never int
67
     ((state (* t))
68
      (a (* unsigned-char))
69
      (alen size-t)
70
      (b (* unsigned-char))
71
      (blen size-t))
72
   (declare (ignore state a alen b blen))
73
   0)
74
 
75
 (define-alien-callable rocksdb-compare-never-with-ts int
76
     ((state (* t))
77
      (a (* unsigned-char))
78
      (alen size-t)
79
      (b (* unsigned-char))
80
      (blen size-t))
81
   (declare (ignore state a alen b blen))
82
   0)
83
 
84
 (define-alien-callable rocksdb-compare-never-without-ts int
85
     ((state (* t))
86
      (a (* unsigned-char))
87
      (alen size-t)
88
      (a-ts unsigned-char)
89
      (b (* unsigned-char))
90
      (blen size-t)
91
      (b-ts unsigned-char))
92
   (declare (ignore state a alen a-ts b blen b-ts))
93
   0)