changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: writebatch callbacks and fixes

changeset 616: c48704d7b06f
parent 615: ae4983075819
child 617: 6f10b3036123
author: Richard Westhaver <ellis@rwest.io>
date: Tue, 20 Aug 2024 21:02:58 -0400
files: emacs/keys.el lisp/ffi/rocksdb/merge.lisp lisp/ffi/rocksdb/pkg.lisp lisp/ffi/rocksdb/tests.lisp lisp/ffi/rocksdb/writebatch.lisp
description: writebatch callbacks and fixes
     1.1--- a/emacs/keys.el	Tue Aug 20 19:12:01 2024 -0400
     1.2+++ b/emacs/keys.el	Tue Aug 20 21:02:58 2024 -0400
     1.3@@ -42,6 +42,7 @@
     1.4   "T" #'toggle-theme
     1.5   "d" #'toggle-debug-on-error
     1.6   "SPC" #'toggle-macro-recording
     1.7+  "x" #'org-clock-toggle-auto-clockout
     1.8   "s" #'slime-toggle
     1.9   "w" #'which-key-mode)
    1.10 
    1.11@@ -79,6 +80,17 @@
    1.12   "a" #'xref-find-apropos
    1.13   "SPC" #'whitespace-cleanup)
    1.14 
    1.15+(defvar-keymap clock-map
    1.16+  :doc "User-specified keymap for org-clock functions. Usually bound to 'C-c c t'."
    1.17+  "j" #'org-clock-goto
    1.18+  "i" #'org-clock-in
    1.19+  "o" #'org-clock-out
    1.20+  "d" #'org-clock-display
    1.21+  "x" #'org-clock-cancel
    1.22+  "l" #'org-clock-in-last
    1.23+  "e" #'org-clock-modify-effort-estimate
    1.24+  "m" #'org-clock-mark-default-task)
    1.25+
    1.26 (defvar-keymap user-map
    1.27   :doc "User-specified keymap usually bound to 'C-c c' and populated in 'custom.el'."
    1.28   :prefix 'user-map
    1.29@@ -107,6 +119,8 @@
    1.30   "z" #'scratch-buffer
    1.31   "C-z" #'scratch-new
    1.32   "Z" #'default-scratch-buffer
    1.33+  "t" #'org-todo
    1.34+  "C-t" clock-map
    1.35   ";" #'prog-comment-dwim
    1.36   "C-;" #'prog-comment-timestamp-keyword)
    1.37 
     2.1--- a/lisp/ffi/rocksdb/merge.lisp	Tue Aug 20 19:12:01 2024 -0400
     2.2+++ b/lisp/ffi/rocksdb/merge.lisp	Tue Aug 20 21:02:58 2024 -0400
     2.3@@ -144,7 +144,7 @@
     2.4      (success (array unsigned-char))
     2.5      (new-vlen (* size-t)))
     2.6   (log:debug! (list key klen existing-val existing-vlen ops ops-length num-ops success new-vlen))
     2.7-  t)
     2.8+  1)
     2.9 
    2.10 (define-alien-callable rocksdb-concat-partial-merge boolean
    2.11     ((key (array unsigned-char))
    2.12@@ -155,7 +155,7 @@
    2.13      (success (array unsigned-char))
    2.14      (new-vlen (* size-t)))
    2.15   (log:debug! (list key klen ops ops-length num-ops success new-vlen))
    2.16-  nil)
    2.17+  0)
    2.18 
    2.19 (define-alien-callable rocksdb-delete-value void
    2.20     ((state (* t))
     3.1--- a/lisp/ffi/rocksdb/pkg.lisp	Tue Aug 20 19:12:01 2024 -0400
     3.2+++ b/lisp/ffi/rocksdb/pkg.lisp	Tue Aug 20 21:02:58 2024 -0400
     3.3@@ -314,7 +314,13 @@
     3.4    :rocksdb-mergeoperator-function
     3.5    :rocksdb-logger-function
     3.6    :rocksdb-compactionfilter-function
     3.7-   :rocksdb-comparator-function))
     3.8+   :rocksdb-comparator-function
     3.9+   :rocksdb-get-ts-size-function
    3.10+   :rocksdb-merge-cf-function
    3.11+   :rocksdb-deleted-cf-function
    3.12+   :rocksdb-put-cf-function
    3.13+   :rocksdb-deleted-function
    3.14+   :rocksdb-put-function))
    3.15 
    3.16 (in-package :rocksdb)
    3.17 
     4.1--- a/lisp/ffi/rocksdb/tests.lisp	Tue Aug 20 19:12:01 2024 -0400
     4.2+++ b/lisp/ffi/rocksdb/tests.lisp	Tue Aug 20 21:02:58 2024 -0400
     4.3@@ -414,7 +414,7 @@
     4.4                (destructor (* rocksdb-destructor-function) (alien-sap (alien-callable-function 'rocksdb-destructor)))
     4.5                (full-merge (* rocksdb-full-merge-function) (alien-sap (alien-callable-function 'rocksdb-concat-full-merge)))
     4.6                (partial-merge (* rocksdb-partial-merge-function) (alien-sap (alien-callable-function 'rocksdb-concat-partial-merge)))
     4.7-               (delete-value (* rocksdb-delete-value-function) (alien-sap (alien-callable-function 'rocksdb-concat-delete-value)))
     4.8+               (delete-value (* rocksdb-delete-value-function) (alien-sap (alien-callable-function 'rocksdb-delete-value)))
     4.9                (name (* rocksdb-name-function) (alien-sap (alien-callable-function 'rocksdb-concat-merge-name))))
    4.10     (is (typep (rocksdb-mergeoperator-create state destructor full-merge partial-merge delete-value name)
    4.11                '(alien (* rocksdb-mergeoperator))))))
    4.12@@ -465,8 +465,25 @@
    4.13 
    4.14 (deftest writebatch ()
    4.15   "Test writebatch functionality."
    4.16-  nil)
    4.17+  (with-alien ((fput (* rocksdb-put-function))
    4.18+               (fdeleted (* rocksdb-deleted-function))
    4.19+               (fdeleted-cf (* rocksdb-deleted-cf-function))
    4.20+               (fput-cf (* rocksdb-put-cf-function))
    4.21+               (fmerge-cf (* rocksdb-merge-cf-function))
    4.22+               (fget-ts (* rocksdb-get-ts-size-function)))
    4.23+    (is (typep
    4.24+         (rocksdb-writebatch-create)
    4.25+         '(alien (* rocksdb-writebatch))))
    4.26+    (is (typep
    4.27+         (rocksdb-writebatch-wi-create 0 0)
    4.28+         '(alien (* rocksdb-writebatch-wi))))))
    4.29 
    4.30-(deftest slicetransform ()
    4.31+(deftest slicetransform (:skip t)
    4.32   "Test slicetransform functionality."
    4.33-  nil)
    4.34+  (with-alien ((state (* t))
    4.35+               (destructor (* rocksdb-destructor-function) (alien-sap (alien-callable-function 'rocksdb-destructor)))
    4.36+               (transform (* t) (* rocksdb-transform-function))
    4.37+               (in-domain (* rocksdb-in-domain-function))
    4.38+               (in-range (* rocksdb-in-range-function))
    4.39+               (name (* rocksdb-name-function) (alien-sap (alien-callable-function 'rocksdb-name))))
    4.40+    (rocksdb-slicetransform-create state destructor transform in-domain in-range name)))
     5.1--- a/lisp/ffi/rocksdb/writebatch.lisp	Tue Aug 20 19:12:01 2024 -0400
     5.2+++ b/lisp/ffi/rocksdb/writebatch.lisp	Tue Aug 20 21:02:58 2024 -0400
     5.3@@ -5,6 +5,52 @@
     5.4 ;;; Code:
     5.5 (in-package :rocksdb)
     5.6 
     5.7+;;; Types
     5.8+(define-alien-type rocksdb-put-function
     5.9+  (function void
    5.10+            (* t)
    5.11+            (array unsigned-char)
    5.12+            size-t
    5.13+            (array unsigned-char)
    5.14+            size-t))
    5.15+
    5.16+(define-alien-type rocksdb-deleted-function
    5.17+  (function void
    5.18+            (* t)
    5.19+            (array unsigned-char)
    5.20+            size-t))
    5.21+
    5.22+(define-alien-type rocksdb-put-cf-function
    5.23+  (function void
    5.24+            (* t)
    5.25+            (unsigned 32)
    5.26+            (array unsigned-char)
    5.27+            size-t
    5.28+            (array unsigned-char)
    5.29+            size-t))
    5.30+
    5.31+(define-alien-type rocksdb-deleted-cf-function
    5.32+  (function void
    5.33+            (* t)
    5.34+            (unsigned 32)
    5.35+            (array unsigned-char)
    5.36+            size-t))
    5.37+            
    5.38+(define-alien-type rocksdb-merge-cf-function
    5.39+  (function void
    5.40+            (* t)
    5.41+            (unsigned 32)
    5.42+            (array unsigned-char)
    5.43+            size-t
    5.44+            (array unsigned-char)
    5.45+            size-t))
    5.46+
    5.47+(define-alien-type rocksdb-get-ts-size-function
    5.48+  (function size-t
    5.49+            (* t)
    5.50+            (unsigned 32)))
    5.51+
    5.52+;;; Alien Functions
    5.53 (define-alien-routine rocksdb-writebatch-create (* rocksdb-writebatch))
    5.54 (define-alien-routine rocksdb-writebatch-create-from (* rocksdb-writebatch)
    5.55   (rep c-string)
    5.56@@ -29,15 +75,15 @@
    5.57 (define-alien-routine rocksdb-writebatch-iterate void
    5.58   (batch (* rocksdb-writebatch))
    5.59   (state (* t))
    5.60-  (put (* t)) ;; function
    5.61-  (deleted (* t))) ;; function
    5.62+  (put (* rocksdb-put-function))
    5.63+  (deleted (* rocksdb-deleted-function)))
    5.64 
    5.65 (define-alien-routine rocksdb-writebatch-iterate-cf void
    5.66   (batch (* rocksdb-writebatch))
    5.67   (state (* t))
    5.68-  (put-cf (* t)) ;; function
    5.69-  (deleted-cf (* t)) ;; function
    5.70-  (merge-cf (* t))) ;; function
    5.71+  (put-cf (* rocksdb-put-cf-function))
    5.72+  (deleted-cf (* rocksdb-deleted-cf-function))
    5.73+  (merge-cf (* rocksdb-merge-cf-function)))
    5.74 
    5.75 (define-alien-routine rocksdb-writebatch-data (array unsigned-char)
    5.76   (batch (* rocksdb-writebatch))
    5.77@@ -57,7 +103,7 @@
    5.78   (ts (array unsigned-char))
    5.79   (tslen size-t)
    5.80   (state (* t))
    5.81-  (get-ts-size (* t))) ;; function
    5.82+  (get-ts-size (* rocksdb-get-ts-size-function)))
    5.83 
    5.84 ;; put
    5.85 (define-alien-routine rocksdb-writebatch-put void
    5.86@@ -256,9 +302,8 @@
    5.87 (define-alien-routine rocksdb-writebatch-wi-iterate void
    5.88   (batch (* rocksdb-writebatch-wi))
    5.89   (state (* t))
    5.90-  (put (* t)) ;; function
    5.91-  (deleted (* t)) ;; function
    5.92-  )
    5.93+  (put (* rocksdb-put-function))
    5.94+  (deleted (* rocksdb-deleted-function)))
    5.95 
    5.96 (define-alien-routine rocksdb-writebatch-wi-data (array unsigned-char)
    5.97   (batch (* rocksdb-writebatch-wi))
    5.98@@ -321,7 +366,7 @@
    5.99   (ts (array unsigned-char))
   5.100   (tslen size-t)
   5.101   (state (* t))
   5.102-  (get-ts-size (* t))) ;; function
   5.103+  (get-ts-size (* rocksdb-get-ts-size-function)))
   5.104 
   5.105 (define-alien-routine rocksdb-writebatch-wi-put void
   5.106   (batch (* rocksdb-writebatch-wi))