changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: emacs and rocksdb upgrades

changeset 606: 6fc04c4d465c
parent 605: 3734c596d103
child 607: 1a5828267b90
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 18 Aug 2024 20:34:26 -0400
files: emacs/default.el emacs/keys.el emacs/lib/inbox.el emacs/lib/publish.el emacs/lib/scrum.el lisp/ffi/rocksdb/batch.lisp lisp/ffi/rocksdb/compaction.lisp lisp/ffi/rocksdb/db.lisp lisp/ffi/rocksdb/macs.lisp lisp/ffi/rocksdb/merge.lisp lisp/ffi/rocksdb/pkg.lisp lisp/ffi/rocksdb/prim.lisp lisp/ffi/rocksdb/rocksdb.asd lisp/ffi/rocksdb/tests.lisp lisp/ffi/rocksdb/writebatch.lisp
description: emacs and rocksdb upgrades

- more org workflow updates
- added scrum.el
- renamed batch.lisp > writebatch.lisp
- callback tests
     1.1--- a/emacs/default.el	Sun Aug 18 01:52:22 2024 -0400
     1.2+++ b/emacs/default.el	Sun Aug 18 20:34:26 2024 -0400
     1.3@@ -745,23 +745,10 @@
     1.4 (use-package imenu-list :ensure t)
     1.5 
     1.6 ;;; Org
     1.7-(setq org-id-link-to-org-use-id t)
     1.8-;; capture templates
     1.9-(setq org-capture-templates
    1.10-      '(("t" "task" entry (file "core.org") "* %^{title}\n- %?" :prepend t)
    1.11-        ("1" "current-task-item" item (clock) "%i%?")
    1.12-        ("2" "current-task-checkbox" checkitem (clock) "%i%?")
    1.13-        ("3" "current-task-region" plain (clock) "%i" :immediate-finish t :empty-lines 1)
    1.14-        ("4" "current-task-kill" plain (clock) "%c" :immediate-finish t :empty-lines 1)
    1.15-        ("l" "log" item (file+headline "log.org" "log") "%U %?" :prepend t)
    1.16-        ("s" "secret" table-line (file+function "krypt" org-ask-location) "| %^{key} | %^{val} |" :immediate-finish t :kill-buffer t)
    1.17-        ("n" "note" plain (file+function "notes.org" org-ask-location) "%?")
    1.18-        ("i" "idea" entry (file "inbox.org") "* OUTLINE %?\n:notes:\n:end:\n- _outline_ [/]\n  - [ ] \n  - [ ] \n- _refs_" :prepend t)
    1.19-        ("b" "bug" entry (file "inbox.org") "* FIX %?\n- _review_\n- _fix_\n- _test_" :prepend t)
    1.20-        ("r" "research" entry (file "inbox.org") "* RESEARCH %?\n:notes:\n:end:\n- _refs_" :prepend t)))
    1.21-
    1.22-(setq org-default-notes-file (join-paths org-directory "inbox.org")
    1.23-      org-capture-use-agenda-date t)
    1.24+(require 'org)
    1.25+(require 'org-agenda)
    1.26+(require 'org-id)
    1.27+(require 'org-protocol)
    1.28 
    1.29 (setq org-html-htmlize-output-type 'css
    1.30       org-html-head-include-default-style nil
    1.31@@ -855,7 +842,7 @@
    1.32 (defun org-agenda-show-week-all (&optional arg ) (interactive "P") (org-agenda arg "n"))
    1.33 
    1.34 (defun org-ask-location ()
    1.35-  "prompt for a location\"\""
    1.36+  "prompt for a location."
    1.37   (let* ((org-refile-targets '((nil :maxlevel . 9)))
    1.38          (hd (condition-case nil
    1.39                  (car (org-refile-get-location))
    1.40@@ -986,7 +973,6 @@
    1.41        t nil))))
    1.42 
    1.43 ;;;; Agenda
    1.44-(require 'org-agenda)
    1.45 (cl-pushnew '("w" "Work in progress tasks" ((todo "WIP") (agenda))) org-agenda-custom-commands)
    1.46 
    1.47 (defvar org-agenda-overriding-header)
     2.1--- a/emacs/keys.el	Sun Aug 18 01:52:22 2024 -0400
     2.2+++ b/emacs/keys.el	Sun Aug 18 20:34:26 2024 -0400
     2.3@@ -83,6 +83,7 @@
     2.4   :prefix 'user-map
     2.5   "c" #'org-capture
     2.6   "l" #'org-store-link
     2.7+  "C-l" #'org-web-tools-insert-link-for-url
     2.8   "f" #'load-file
     2.9   "u" #'compile
    2.10   "a" #'org-agenda
     3.1--- a/emacs/lib/inbox.el	Sun Aug 18 01:52:22 2024 -0400
     3.2+++ b/emacs/lib/inbox.el	Sun Aug 18 20:34:26 2024 -0400
     3.3@@ -30,8 +30,7 @@
     3.4 (require 'org)
     3.5 (require 'org-agenda)
     3.6 (require 'default)
     3.7-(require 'uml-mode)
     3.8-(require 'eieio)
     3.9+;; (require 'uml-mode)
    3.10 (require 'org-expiry)
    3.11 
    3.12 (defgroup inbox nil
    3.13@@ -57,10 +56,53 @@
    3.14   "Then name of the org-inbox configuration buffer.")
    3.15 
    3.16 (defvar org-inbox-properties
    3.17-  '("NEXT" "PREV" "FROM" "TO" "OWNER" "PROJECT" "BLOCKER"))
    3.18+  '("NEXT" "PREV" "FROM" "TO" "OWNER" "PROJECT" "BLOCKER" "VERSION"))
    3.19 
    3.20 (defvar org-inbox-db-schema
    3.21   '(id file node edge contents properties schedule))
    3.22+
    3.23+;;; Capture
    3.24+(setq org-id-link-to-org-use-id t
    3.25+      org-protocol-default-template-key "L")
    3.26+
    3.27+;; capture templates
    3.28+(setq org-capture-templates
    3.29+      `(("i" "inbox-item" entry (file ,org-inbox-file)
    3.30+         "* %?\n%i"
    3.31+         :empty-lines 1)
    3.32+        ("t" "inbox-task" entry (file ,org-inbox-file) "* TODO %^{item}\n")
    3.33+        ("n" "inbox-note" entry (file ,org-inbox-file) "* NOTE %^{item}\n%a")
    3.34+        ("l" "inbox-link" entry (file ,org-inbox-file)
    3.35+         "* LINK %l")
    3.36+        ("L" "inbox-protocol-link" entry (file ,org-inbox-file)
    3.37+         "* LINK [[%:link][%:description]]\n%:initial" :empty-lines 1)
    3.38+        ("w" "inbox-web-link" entry (file ,org-inbox-file)
    3.39+         "* LINK %?"
    3.40+         :hook (lambda ()
    3.41+                 (goto-char (pos-eol))
    3.42+                 (org-web-tools-insert-link-for-url (org-web-tools--get-first-url))))
    3.43+        ("1" "current-task-item" item (clock) "%i%?")
    3.44+        ("2" "current-task-checkbox" checkitem (clock) "%i%?")
    3.45+        ("3" "current-task-region" plain (clock) "%i" :immediate-finish t :empty-lines 1)
    3.46+        ("4" "current-task-kill" plain (clock) "%c" :immediate-finish t :empty-lines 1)
    3.47+        ("l" "log" item (file+headline "log.org" "log") "%U %?" :prepend t)
    3.48+        ("s" "secret" table-line (file+function "krypt" org-ask-location) "| %^{key} | %^{val} |" :immediate-finish t :kill-buffer t)
    3.49+        ("N" "note-item" plain (file+function "notes.org" org-ask-location) "%?")))
    3.50+
    3.51+(defun org-insert-logbook-drawer () (org-log-beginning t))
    3.52+
    3.53+;; (add-hook 'org-capture-mode-hook
    3.54+;;           #'org-insert-logbook-drawer)
    3.55+
    3.56+(add-hook 'org-capture-mode-hook
    3.57+  #'org-id-get-create)
    3.58+
    3.59+(add-hook 'org-capture-mode-hook
    3.60+          #'org-expiry-insert-created)
    3.61+
    3.62+(setq org-default-notes-file (join-paths org-directory "inbox.org")
    3.63+      org-capture-use-agenda-date t)
    3.64+
    3.65 ;;; Utils
    3.66 ;; `org-archive-all-done' doesn't work the way we want. This function
    3.67 ;; will archive all done tasks in the current subtree, or the whole file
    3.68@@ -236,6 +278,15 @@
    3.69 ;;; dblocks
    3.70 (defun org-dblock-write:summary ())
    3.71 
    3.72+(defun org-inbox-configure-dblock ()
    3.73+  "Configure the current org-inbox-dblock at point."
    3.74+  (interactive)
    3.75+  (with-demoted-errors "Error: %S"
    3.76+    (let* ((beginning (org-beginning-of-dblock))
    3.77+           (parameters (org-prepare-dblock)))
    3.78+      (org-inbox-show-config-buffer (current-buffer) beginning parameters))))
    3.79+
    3.80+;;; ui
    3.81 (defun org-inbox-show-config (&optional buffer position parameters)
    3.82   (interactive)
    3.83   (switch-to-buffer org-inbox-config-buffer-name)
    3.84@@ -258,13 +309,5 @@
    3.85   (use-local-map widget-keymap)
    3.86   (widget-setup))
    3.87 
    3.88-(defun org-inbox-configure-dblock ()
    3.89-  "Configure the current org-inbox-dblock at point."
    3.90-  (interactive)
    3.91-  (with-demoted-errors "Error: %S"
    3.92-    (let* ((beginning (org-beginning-of-dblock))
    3.93-           (parameters (org-prepare-dblock)))
    3.94-      (org-inbox-show-config-buffer (current-buffer) beginning parameters))))
    3.95-
    3.96 (provide 'inbox)
    3.97 ;; inbox.el ends here
     4.1--- a/emacs/lib/publish.el	Sun Aug 18 01:52:22 2024 -0400
     4.2+++ b/emacs/lib/publish.el	Sun Aug 18 20:34:26 2024 -0400
     4.3@@ -5,6 +5,7 @@
     4.4 ;;; Code:
     4.5 (require 'ox-publish)
     4.6 (require 'org-id)
     4.7+(require 'dash)
     4.8 ;; vendored
     4.9 (require 'htmlize)
    4.10 (defvar project-dir "~/comp/org")
     5.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2+++ b/emacs/lib/scrum.el	Sun Aug 18 20:34:26 2024 -0400
     5.3@@ -0,0 +1,35 @@
     5.4+;;; scrum.el --- Scrum-like Planning and Roadmaps in Org  -*- lexical-binding: t; -*-
     5.5+
     5.6+;; Copyright (C) 2024  Richard Westhaver
     5.7+
     5.8+;; Author: Richard Westhaver <richard.westhaver@gmail.com>
     5.9+;; Keywords: maint
    5.10+
    5.11+;; This program is free software; you can redistribute it and/or modify
    5.12+;; it under the terms of the GNU General Public License as published by
    5.13+;; the Free Software Foundation, either version 3 of the License, or
    5.14+;; (at your option) any later version.
    5.15+
    5.16+;; This program is distributed in the hope that it will be useful,
    5.17+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.18+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.19+;; GNU General Public License for more details.
    5.20+
    5.21+;; You should have received a copy of the GNU General Public License
    5.22+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
    5.23+
    5.24+;;; Commentary:
    5.25+
    5.26+;; ref: https://www.scrum.org/resources/what-scrum-module
    5.27+
    5.28+;; roadmap: https://compiler.company/plan/roadmap.html
    5.29+
    5.30+;; tasks: https://compiler.company/plan/tasks
    5.31+
    5.32+;;; Code:
    5.33+(require 'ulang)
    5.34+(require 'uml-mode)
    5.35+(defvar scrum-properties '("SPRINT" "RELEASE" "TASKID"))
    5.36+
    5.37+(provide 'scrum)
    5.38+;;; scrum.el ends here
     6.1--- a/lisp/ffi/rocksdb/batch.lisp	Sun Aug 18 01:52:22 2024 -0400
     6.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3@@ -1,16 +0,0 @@
     6.4-;;; batch.lisp --- RocksDB Writebatches
     6.5-
     6.6-;; RocksDB Writebatch Lisp FFI
     6.7-
     6.8-;;; Code:
     6.9-(in-package :rocksdb)
    6.10-
    6.11-;; put
    6.12-
    6.13-;; deleted
    6.14-
    6.15-;; put-cf
    6.16-
    6.17-;; deleted-cf
    6.18-
    6.19-;; merge-cf
     7.1--- a/lisp/ffi/rocksdb/compaction.lisp	Sun Aug 18 01:52:22 2024 -0400
     7.2+++ b/lisp/ffi/rocksdb/compaction.lisp	Sun Aug 18 20:34:26 2024 -0400
     7.3@@ -10,6 +10,29 @@
     7.4 
     7.5 ;; ref: https://github.com/facebook/rocksdb/wiki/Compaction-Filter
     7.6 
     7.7+#|
     7.8+* RocksDB snapshots do not guarantee to preserve the state of the DB in the
     7.9+presence of CompactionFilter. Data seen from a snapshot might disappear after
    7.10+a table file created with a `CompactionFilter` is installed. If you use
    7.11+snapshots, think twice about whether you want to use `CompactionFilter` and
    7.12+whether you are using it in a safe way.
    7.13+
    7.14+* If multithreaded compaction is being used *and* a single CompactionFilter
    7.15+instance was supplied via Options::compaction_filter, CompactionFilter
    7.16+methods may be called from different threads concurrently.  The application
    7.17+must ensure that such calls are thread-safe. If the CompactionFilter was
    7.18+created by a factory, then it will only ever be used by a single thread that
    7.19+is doing the table file creation, and this call does not need to be
    7.20+thread-safe.  However, multiple filters may be in existence and operating
    7.21+concurrently.
    7.22+
    7.23+* The key passed to the filtering methods includes the timestamp if
    7.24+user-defined timestamps are enabled.
    7.25+
    7.26+* Exceptions MUST NOT propagate out of overridden functions into RocksDB,
    7.27+because RocksDB is not exception-safe. This could cause undefined behavior
    7.28+including data loss, unreported corruption, deadlocks, and more.
    7.29+|#
    7.30 ;;; Code:
    7.31 (in-package :rocksdb)
    7.32 
    7.33@@ -29,7 +52,13 @@
    7.34     (function (* rocksdb-compactionfilter)
    7.35               (* t)
    7.36               (* rocksdb-compactionfiltercontext)))
    7.37-            
    7.38+
    7.39+(define-alien-routine rocksdb-compactionfilter-create (* rocksdb-compactionfilter)
    7.40+  (state (* t))
    7.41+  (destructor (* rocksdb-destructor-function))
    7.42+  (filter (* rocksdb-filter-function))
    7.43+  (name (* rocksdb-name-function)))
    7.44+
    7.45 (define-alien-routine rocksdb-compactionfilter-set-ignore-snapshots void
    7.46   (self (* rocksdb-compactionfilter)) (val unsigned-char))
    7.47 
    7.48@@ -44,18 +73,33 @@
    7.49   (context (* rocksdb-compactionfiltercontext)))
    7.50 
    7.51 ;;; Compaction Filter Factory
    7.52-(define-alien-routine rocksdb-compactionfilter-create (* rocksdb-compactionfilter)
    7.53+(define-alien-routine rocksdb-compactionfilterfactory-create (* rocksdb-compactionfilterfactory)
    7.54   (state (* t))
    7.55   (destructor (* rocksdb-destructor-function))
    7.56-  (generator (* rocksdb-create-compaction-filter-function))
    7.57-  (context (* rocksdb-compactionfiltercontext)))
    7.58+  (creator (* rocksdb-create-compaction-filter-function))
    7.59+  (name (* rocksdb-name-function)))
    7.60 
    7.61-(define-alien-routine rocksdb-compacitonfilter-destroy void
    7.62+(define-alien-routine rocksdb-compacitonfilterfactory-destroy void
    7.63   (factory (* rocksdb-compactionfilterfactory)))
    7.64 
    7.65-;; maybe not possible? test
    7.66-(define-alien-callable rocksdb-create-compaction-filter (* rocksdb-compactionfilter)
    7.67+(define-alien-callable rocksdb-filter-never unsigned-char
    7.68+    ((state (* t))
    7.69+     (level int)
    7.70+     (key (array unsigned-char))
    7.71+     (key-length size-t)
    7.72+     (existing-val (array unsigned-char))
    7.73+     (existing-val-length size-t)
    7.74+     (new-val (array unsigned-char))
    7.75+     (new-val-length size-t)
    7.76+     (value-changed (* unsigned-char)))
    7.77+  (declare (ignore state level key key-length existing-val existing-val-length new-val new-val-length value-changed))
    7.78+  0)
    7.79+
    7.80+(define-alien-callable rocksdb-create-compaction-filter-never (* rocksdb-compactionfilter)
    7.81     ((state (* t))
    7.82      (context (* rocksdb-compactionfiltercontext)))
    7.83-  (declare (ignore state context)))
    7.84-
    7.85+  (rocksdb-compactionfilter-create
    7.86+   state
    7.87+   (alien-sap (alien-callable-function 'rocksdb-destructor))
    7.88+   (alien-sap (alien-callable-function 'rocksdb-filter-never))
    7.89+   context))
     8.1--- a/lisp/ffi/rocksdb/db.lisp	Sun Aug 18 01:52:22 2024 -0400
     8.2+++ b/lisp/ffi/rocksdb/db.lisp	Sun Aug 18 20:34:26 2024 -0400
     8.3@@ -410,11 +410,21 @@
     8.4   (db (* rocksdb))
     8.5   (opt (* rocksdb-readoptions)))
     8.6 
     8.7+(define-alien-routine rocksdb-get-updates-since (* rocksdb-wal-iterator)
     8.8+  (db (* rocksdb))
     8.9+  (opts (* rocksdb-readoptions)))
    8.10+
    8.11 (define-alien-routine rocksdb-create-iterator-cf (* rocksdb-iterator)
    8.12   (db (* rocksdb))
    8.13   (opt (* rocksdb-readoptions))
    8.14   (cf (* rocksdb-column-family-handle)))
    8.15 
    8.16+(def-with-errptr rocksdb-create-iterators void
    8.17+  (db (* rocksdb))
    8.18+  (opts (* rocksdb-readoptions))
    8.19+  (cfs (array (* rocksdb-column-family-handle)))
    8.20+  (iters (array (* rocksdb-iterator))))
    8.21+  
    8.22 (define-alien-routine rocksdb-iter-destroy void 
    8.23       (iter (* rocksdb-iterator)))
    8.24 (define-alien-routine rocksdb-iter-seek-to-first void 
     9.1--- a/lisp/ffi/rocksdb/macs.lisp	Sun Aug 18 01:52:22 2024 -0400
     9.2+++ b/lisp/ffi/rocksdb/macs.lisp	Sun Aug 18 20:34:26 2024 -0400
     9.3@@ -1,52 +1,9 @@
     9.4-;;; rocksdb/macs.lisp --- RocksDB FFI Macros
     9.5+;;; macs.lisp --- RocksDB Alien Macros
     9.6 
     9.7-;;
     9.8+;; Convenience Macros for working with RocksDB Alien types
     9.9 
    9.10 ;;; Code:
    9.11 (in-package :rocksdb)
    9.12 
    9.13-;;; Macros
    9.14-(defmacro def-with-errptr (name result-type &rest args)
    9.15-  `(progn
    9.16-     (define-alien-routine ,name ,result-type ,@args (errptr rocksdb-errptr))
    9.17-     (export '(,name) :rocksdb)))
    9.18-
    9.19-(defmacro define-opt (name)
    9.20-  (let ((c-fn (symbolicate name '-create))
    9.21-        (d-fn (symbolicate name '-destroy))
    9.22-        (typ (symbolicate name '-t)))
    9.23-    `(progn
    9.24-       (define-alien-type ,name (struct ,typ))
    9.25-       (define-alien-routine ,c-fn (* ,name))
    9.26-       (define-alien-routine ,d-fn void
    9.27-         (opt (* ,name)))
    9.28-       (export '(,c-fn ,d-fn ,name) :rocksdb))))
    9.29-
    9.30-(defmacro define-opt-accessor (opt name &optional val)
    9.31-  (let* ((g-fn (symbolicate opt '-get- name))
    9.32-         (s-fn (symbolicate opt '-set- name)))
    9.33-    (if val
    9.34-        `(progn
    9.35-           (define-alien-routine ,s-fn void
    9.36-             (opt (* ,opt))
    9.37-             (val ,val))
    9.38-           (define-alien-routine ,g-fn ,val
    9.39-             (opt (* ,opt)))
    9.40-           (export '(,g-fn ,s-fn) :rocksdb))
    9.41-        `(progn
    9.42-           (define-alien-routine ,s-fn void
    9.43-             (opt (* ,opt)) 
    9.44-             (val boolean))
    9.45-           (define-alien-routine ,g-fn boolean
    9.46-             (opt (* ,opt)))
    9.47-           (export '(,g-fn ,s-fn) :rocksdb)))))
    9.48-
    9.49-(defmacro export-opt-accessors (opt &rest names)
    9.50-  (let ((forms
    9.51-          (loop for n in names
    9.52-                collect `(export (list
    9.53-                                  ',(symbolicate opt '-get- n)
    9.54-                                  ',(symbolicate opt '-set- n)) :rocksdb))))
    9.55-    `(progn ,@forms)))
    9.56 
    9.57 (defmacro define-merge-operator-callbacks (name full partial state destructor delete-fn))
    10.1--- a/lisp/ffi/rocksdb/merge.lisp	Sun Aug 18 01:52:22 2024 -0400
    10.2+++ b/lisp/ffi/rocksdb/merge.lisp	Sun Aug 18 20:34:26 2024 -0400
    10.3@@ -88,8 +88,6 @@
    10.4 (define-alien-type rocksdb-name-function
    10.5     (function c-string))
    10.6 
    10.7-(deftype rocksdb-merge-operands () '(array (octet-vector)))
    10.8-
    10.9 ;; (sb-alien::define-alien-callable mangle int () 0)
   10.10 
   10.11 (define-alien-routine rocksdb-mergeoperator-create (* rocksdb-mergeoperator)
   10.12@@ -108,19 +106,16 @@
   10.13 (deftype rocksdb-mergeoperator-function ()
   10.14   '(function (octet-vector (or octet-vector null) &rest t) (or null octet-vector)))
   10.15 
   10.16-(define-alien-callable rocksdb-delete-value (* t)
   10.17-    ((val (array unsigned-char))
   10.18-     (vlen size-t))
   10.19-  (declare (ignore val vlen))
   10.20-  nil)
   10.21- 
   10.22 (define-alien-callable rocksdb-destructor void ((self (* t)))
   10.23   (free-alien self)
   10.24   (values))
   10.25 
   10.26 (define-alien-callable rocksdb-name c-string () (make-alien-string (symbol-name (gensym "rocksdb:"))))
   10.27 
   10.28-(define-alien-callable rocksdb-concat-merge-name c-string () (make-alien-string "concat-merge"))
   10.29+;;; Associative Merge
   10.30+
   10.31+;;; Concat Merge
   10.32+(define-alien-callable rocksdb-concat-merge-name c-string () (make-alien-string "cc:concat"))
   10.33 
   10.34 (define-alien-callable rocksdb-concat-full-merge boolean
   10.35     ((key (array unsigned-char))
   10.36@@ -146,8 +141,13 @@
   10.37   (log:debug! (list key klen ops ops-length num-ops success new-vlen))
   10.38   0)
   10.39 
   10.40-(define-alien-callable rocksdb-concat-delete-value void
   10.41+(define-alien-callable rocksdb-delete-value void
   10.42     ((state (* t))
   10.43      (value c-string)
   10.44      (value-length size-t))
   10.45+  (declare (ignore state))
   10.46+  ;; TODO 2024-08-18: test if this is needed
   10.47+  (unless (zerop value-length)
   10.48+    (log:trace! "deleting value:" value)
   10.49+    (setf value nil))
   10.50   (values))
    11.1--- a/lisp/ffi/rocksdb/pkg.lisp	Sun Aug 18 01:52:22 2024 -0400
    11.2+++ b/lisp/ffi/rocksdb/pkg.lisp	Sun Aug 18 20:34:26 2024 -0400
    11.3@@ -273,7 +273,14 @@
    11.4    :rocksdb-backup-engine-info-size
    11.5    :rocksdb-backup-engine-info-num-files
    11.6    :rocksdb-backup-engine-info-destroy
    11.7-   :rocksdb-iter-key))
    11.8+   :rocksdb-iter-key
    11.9+   :rocksdb-get-updates-since
   11.10+   :rocksdb-create-iterators
   11.11+   :rocksdb-create-compaction-filter-never
   11.12+   :rocksdb-compacitonfilterfactory-destroy
   11.13+   :rocksdb-compactionfilterfactory-create
   11.14+   :rocksdb-filter-never
   11.15+   :rocksdb-delete-value))
   11.16 
   11.17 (in-package :rocksdb)
   11.18 
    12.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2+++ b/lisp/ffi/rocksdb/prim.lisp	Sun Aug 18 20:34:26 2024 -0400
    12.3@@ -0,0 +1,50 @@
    12.4+;;; rocksdb/prim.lisp --- RocksDB Primitive FFI Macros
    12.5+
    12.6+;;
    12.7+
    12.8+;;; Code:
    12.9+(in-package :rocksdb)
   12.10+
   12.11+;;; Early Macros
   12.12+(defmacro def-with-errptr (name result-type &rest args)
   12.13+  `(progn
   12.14+     (define-alien-routine ,name ,result-type ,@args (errptr rocksdb-errptr))
   12.15+     (export '(,name) :rocksdb)))
   12.16+
   12.17+(defmacro define-opt (name)
   12.18+  (let ((c-fn (symbolicate name '-create))
   12.19+        (d-fn (symbolicate name '-destroy))
   12.20+        (typ (symbolicate name '-t)))
   12.21+    `(progn
   12.22+       (define-alien-type ,name (struct ,typ))
   12.23+       (define-alien-routine ,c-fn (* ,name))
   12.24+       (define-alien-routine ,d-fn void
   12.25+         (opt (* ,name)))
   12.26+       (export '(,c-fn ,d-fn ,name) :rocksdb))))
   12.27+
   12.28+(defmacro define-opt-accessor (opt name &optional val)
   12.29+  (let* ((g-fn (symbolicate opt '-get- name))
   12.30+         (s-fn (symbolicate opt '-set- name)))
   12.31+    (if val
   12.32+        `(progn
   12.33+           (define-alien-routine ,s-fn void
   12.34+             (opt (* ,opt))
   12.35+             (val ,val))
   12.36+           (define-alien-routine ,g-fn ,val
   12.37+             (opt (* ,opt)))
   12.38+           (export '(,g-fn ,s-fn) :rocksdb))
   12.39+        `(progn
   12.40+           (define-alien-routine ,s-fn void
   12.41+             (opt (* ,opt)) 
   12.42+             (val boolean))
   12.43+           (define-alien-routine ,g-fn boolean
   12.44+             (opt (* ,opt)))
   12.45+           (export '(,g-fn ,s-fn) :rocksdb)))))
   12.46+
   12.47+(defmacro export-opt-accessors (opt &rest names)
   12.48+  (let ((forms
   12.49+          (loop for n in names
   12.50+                collect `(export (list
   12.51+                                  ',(symbolicate opt '-get- n)
   12.52+                                  ',(symbolicate opt '-set- n)) :rocksdb))))
   12.53+    `(progn ,@forms)))
    13.1--- a/lisp/ffi/rocksdb/rocksdb.asd	Sun Aug 18 01:52:22 2024 -0400
    13.2+++ b/lisp/ffi/rocksdb/rocksdb.asd	Sun Aug 18 20:34:26 2024 -0400
    13.3@@ -11,7 +11,7 @@
    13.4   :depends-on (:std :log)
    13.5   :serial t
    13.6   :components ((:file "pkg")
    13.7-               (:file "macs")
    13.8+               (:file "prim")
    13.9                (:file "types")
   13.10                (:file "opts")
   13.11                (:file "sst")
   13.12@@ -21,8 +21,10 @@
   13.13                (:file "merge")
   13.14                (:file "compaction")
   13.15                (:file "comparator")
   13.16+               (:file "writebatch")
   13.17                (:file "stats")
   13.18-               (:file "vars"))
   13.19+               (:file "vars")
   13.20+               (:file "macs"))
   13.21   :in-order-to ((test-op (test-op "rocksdb/tests"))))
   13.22 
   13.23 (defsystem "rocksdb/tests"
    14.1--- a/lisp/ffi/rocksdb/tests.lisp	Sun Aug 18 01:52:22 2024 -0400
    14.2+++ b/lisp/ffi/rocksdb/tests.lisp	Sun Aug 18 20:34:26 2024 -0400
    14.3@@ -393,7 +393,10 @@
    14.4        (parse-integer
    14.5         (string-trim "rocksdb:" (alien-funcall (alien-callable-function 'rocksdb-name))))))
    14.6   ;; returns No Value
    14.7-  (is (null (alien-funcall (alien-callable-function 'rocksdb-concat-delete-value) nil "" 0)))
    14.8+  (with-alien ((str c-string (make-alien-string ""))
    14.9+               (state (* t)))
   14.10+    (is (null (alien-funcall (alien-callable-function 'rocksdb-delete-value) state str 1))))
   14.11+
   14.12   (is (null (alien-funcall (alien-callable-function 'rocksdb-destructor) (make-alien (* t)))))
   14.13 
   14.14   ;; null merge op
   14.15@@ -419,18 +422,33 @@
   14.16 (deftest comparator ()
   14.17   "Test low-level comparator API."
   14.18   (with-alien ((state (* t))
   14.19-               (destructor (* rocksdb-destructor-function))
   14.20-               (compare (* rocksdb-compare-function))
   14.21-               (name (* rocksdb-name-function)))
   14.22-    (rocksdb-comparator-create state destructor compare name)))
   14.23+               (destructor (* rocksdb-destructor-function) (alien-sap (alien-callable-function 'rocksdb-destructor)))
   14.24+               (compare (* rocksdb-compare-function) (alien-sap (alien-callable-function 'rocksdb-compare-never)))
   14.25+               (compare-with-ts (* rocksdb-compare-with-ts-function))
   14.26+               (compare-without-ts (* rocksdb-compare-without-ts-function))
   14.27+               (name (* rocksdb-name-function) (alien-sap (alien-callable-function 'rocksdb-name))))
   14.28+    (is (typep (rocksdb-comparator-create state destructor compare name)
   14.29+               '(alien (* rocksdb-comparator))))
   14.30+    (is (typep (rocksdb-comparator-with-ts-create state destructor compare compare-with-ts compare-without-ts name)
   14.31+               '(alien (* rocksdb-comparator))))))
   14.32 
   14.33 (deftest compaction ()
   14.34   "Test low-level compactionfilter API."
   14.35   (with-alien ((state (* t))
   14.36-               (context (* rocksdb-compactionfiltercontext))
   14.37-               (destructor (* rocksdb-destructor-function))
   14.38-               (generator (* rocksdb-create-compaction-filter-function)))
   14.39-    (alien-funcall (alien-callable-function 'rocksdb-create-compaction-filter) state context)))
   14.40+               (context (* rocksdb-compactionfiltercontext)))
   14.41+    (is (typep
   14.42+         (rocksdb-compactionfilter-create state
   14.43+                                          (alien-sap (alien-callable-function 'rocksdb-destructor))
   14.44+(alien-sap (alien-callable-function 'rocksdb-filter-never))
   14.45+                                          (alien-sap (alien-callable-function 'rocksdb-name)))
   14.46+         '(alien (* rocksdb-compactionfilter))))
   14.47+    (is (typep
   14.48+         (rocksdb-compactionfilterfactory-create state
   14.49+                                                 (alien-sap (alien-callable-function 'rocksdb-destructor))
   14.50+                                                 (alien-sap (alien-callable-function
   14.51+                                                             'rocksdb-create-compaction-filter-never))
   14.52+                                                 (alien-sap (alien-callable-function 'rocksdb-name)))
   14.53+         '(alien (* rocksdb-compactionfilterfactory))))))
   14.54     
   14.55 (deftest logger ()
   14.56   "Test logging functionality.")
    15.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2+++ b/lisp/ffi/rocksdb/writebatch.lisp	Sun Aug 18 20:34:26 2024 -0400
    15.3@@ -0,0 +1,16 @@
    15.4+;;; writebatch.lisp --- RocksDB Writebatches
    15.5+
    15.6+;; RocksDB Writebatch Lisp FFI
    15.7+
    15.8+;;; Code:
    15.9+(in-package :rocksdb)
   15.10+
   15.11+;; put
   15.12+
   15.13+;; deleted
   15.14+
   15.15+;; put-cf
   15.16+
   15.17+;; deleted-cf
   15.18+
   15.19+;; merge-cf