changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: rocksdb updates and tests, emacs org config

changeset 618: 5e57683a0c28
parent 617: 6f10b3036123
child 619: 35a579313b80
author: Richard Westhaver <ellis@rwest.io>
date: Wed, 21 Aug 2024 21:14:46 -0400
files: emacs/keys.el emacs/lib/publish.el emacs/lib/ulang.el lisp/ffi/rocksdb/logger.lisp lisp/ffi/rocksdb/macs.lisp lisp/ffi/rocksdb/rocksdb.asd lisp/ffi/rocksdb/tests.lisp
description: rocksdb updates and tests, emacs org config
     1.1--- a/emacs/keys.el	Tue Aug 20 21:05:08 2024 -0400
     1.2+++ b/emacs/keys.el	Wed Aug 21 21:14:46 2024 -0400
     1.3@@ -101,9 +101,9 @@
     1.4   "u" #'compile
     1.5   "a" #'org-agenda
     1.6   "A" #'org-agenda-show-week-all
     1.7-  "<return>" #'shell
     1.8-  "C-<return>" #'term
     1.9-  "S-<return>" #'eshell-new
    1.10+  "<return>" #'eshell
    1.11+  "C-<return>" #'eshell-new
    1.12+  "s-<return>" #'term
    1.13   "!" #'async-shell-command
    1.14   "i" #'imenu
    1.15   "SPC" toggle-map
     2.1--- a/emacs/lib/publish.el	Tue Aug 20 21:05:08 2024 -0400
     2.2+++ b/emacs/lib/publish.el	Wed Aug 21 21:14:46 2024 -0400
     2.3@@ -55,7 +55,7 @@
     2.4         ("meta"
     2.5          :base-directory ,(expand-file-name "meta" project-dir)
     2.6          :base-extension "org"
     2.7-         :recursive t
     2.8+         :recursive nil
     2.9          :footnote-section-p t
    2.10          :html-doctype "<!doctype html>"
    2.11          :publishing-directory ,(expand-file-name "meta" publish-dir)
     3.1--- a/emacs/lib/ulang.el	Tue Aug 20 21:05:08 2024 -0400
     3.2+++ b/emacs/lib/ulang.el	Wed Aug 21 21:14:46 2024 -0400
     3.3@@ -45,7 +45,7 @@
     3.4 (org-export-translate-to-lang (list '("Table of Contents" "Index")) "ulang")
     3.5 
     3.6 ;; todo keywords
     3.7-(setq org-stuck-projects '("+PROJECT+LEVEL=2|HOLD|WAIT|TEST|DRAFT|REVIEW|KLUDGE/-DONE" ("NEXT") nil ""))
     3.8+(setq org-stuck-projects '("+PROJECT/-DONE" ("NEXT") nil ""))
     3.9 
    3.10 (setq org-todo-keywords
    3.11       '((type "TBD(0!)" "TODO(t!)" "|")
    3.12@@ -54,7 +54,7 @@
    3.13         (sequence "FIND(q!)" "READ(r@!)" "WATCH(W@!)" "|")
    3.14         (sequence "RESEARCH(s!)" "RECORD(e!)" "|")
    3.15         (sequence "OUTLINE(O!)" "RESEARCH(A!)" "DRAFT(M!)" "REVIEW(V!)" "|")
    3.16-        (type "FIXME(i!)" "TEST(T!)" "BENCH(b!)" "DEPLOY(D!)" "RUN(X!)" "LOG(L!)" "|")
    3.17+        (type "FIXME(i!)" "|" "TEST(T!)" "BENCH(b!)" "DEPLOY(D!)" "RUN(X!)" "LOG(L!)" "|")
    3.18         (type "KLUDGE(k@!)" "HACK(h!)" "NOTE(n!)" "CODE(c!)" "LINK(l!)" "|")
    3.19         (type "PROJECT(p!)" "PRODUCT(P!)" "SPRINT(S!)" "RELEASE(R!)" "|")
    3.20         (type "GOTO(g!)" "|")
     4.1--- a/lisp/ffi/rocksdb/logger.lisp	Tue Aug 20 21:05:08 2024 -0400
     4.2+++ b/lisp/ffi/rocksdb/logger.lisp	Wed Aug 21 21:14:46 2024 -0400
     4.3@@ -25,7 +25,6 @@
     4.4   (priv (* t)))
     4.5 
     4.6 ;; logger callback
     4.7-
     4.8 (define-alien-callable rocksdb-log-default void
     4.9     ((priv (* t))
    4.10      (lev unsigned)
     5.1--- a/lisp/ffi/rocksdb/macs.lisp	Tue Aug 20 21:05:08 2024 -0400
     5.2+++ b/lisp/ffi/rocksdb/macs.lisp	Wed Aug 21 21:14:46 2024 -0400
     5.3@@ -41,7 +41,7 @@
     5.4       `(progn
     5.5          (define-full-merge-op ,fmerge ,@full)
     5.6          (define-partial-merge-op ,pmerge ,@partial)
     5.7-         (define-alien-callable ,mname c-string () ,name)
     5.8+         (define-alien-callable ,mname c-string () (string ',name))
     5.9          (defun ,mcreate ()
    5.10            (rocksdb-mergeoperator-create ,state
    5.11                                          (alien-sap (alien-callable-function ',destructor))
     6.1--- a/lisp/ffi/rocksdb/rocksdb.asd	Tue Aug 20 21:05:08 2024 -0400
     6.2+++ b/lisp/ffi/rocksdb/rocksdb.asd	Wed Aug 21 21:14:46 2024 -0400
     6.3@@ -22,6 +22,7 @@
     6.4                (:file "compaction")
     6.5                (:file "comparator")
     6.6                (:file "writebatch")
     6.7+               (:file "logger")
     6.8                (:file "stats")
     6.9                (:file "vars")
    6.10                (:file "macs"))
     7.1--- a/lisp/ffi/rocksdb/tests.lisp	Tue Aug 20 21:05:08 2024 -0400
     7.2+++ b/lisp/ffi/rocksdb/tests.lisp	Wed Aug 21 21:14:46 2024 -0400
     7.3@@ -12,6 +12,9 @@
     7.4 (load-rocksdb)
     7.5 (init-log-timestamp)
     7.6 
     7.7+(defun make-errptr ()
     7.8+  (make-alien rocksdb-errptr))
     7.9+
    7.10 (defun rocksdb-test-dir ()
    7.11   (format nil "/tmp/~A/" (gensym "rocksdb-tests-")))
    7.12 
    7.13@@ -23,6 +26,19 @@
    7.14     (rocksdb-options-set-create-if-missing default t)
    7.15     default))
    7.16 
    7.17+(defmacro with-errptr (sym &body body)
    7.18+  `(with-alien ((,sym rocksdb-errptr (make-errptr)))
    7.19+     ,@body))
    7.20+
    7.21+(defmacro with-temp-db (sym (&optional (opts (test-opts)) (path (rocksdb-test-dir))) &body body)
    7.22+  `(with-errptr err
    7.23+     (let* ((opts ,opts)
    7.24+            (path ,path)
    7.25+            (,sym (rocksdb-open opts path err)))
    7.26+       (unwind-protect
    7.27+            (progn ,@body)
    7.28+         (rocksdb-close ,sym)))))
    7.29+
    7.30 ;; not thread safe (gensym-counter)
    7.31 (defun genkey (&optional prefix) (string-to-octets (symbol-name (gensym (or prefix "key")))))
    7.32 (defun genval (&optional prefix) (string-to-octets (symbol-name (gensym (or prefix "val")))))
    7.33@@ -131,9 +147,6 @@
    7.34     (rocksdb-readoptions-destroy ropts)
    7.35     (rocksdb-block-based-options-destroy bopts)))
    7.36 
    7.37-(defun make-errptr ()
    7.38-  (make-alien rocksdb-errptr))
    7.39-
    7.40 (deftest db-basic ()
    7.41   "Test basic RocksDB functionality. Inserts KV pair into a temporary
    7.42 DB where K and V are both Lisp strings."
    7.43@@ -368,6 +381,10 @@
    7.44     (is (stringp (debug! (rocksdb-property-value db (make-alien-string "rocksdb.stats")))))
    7.45     (is (zerop (parse-integer (rocksdb-property-value db (make-alien-string "rocksdb.num-files-at-level3")))))))
    7.46 
    7.47+(define-merge-operator dummy nil
    7.48+  :full nil
    7.49+  :partial nil)
    7.50+
    7.51 (deftest merge ()
    7.52   "Test low-level merge-operator functionality using Alien Callbacks."
    7.53   (is (with-alien ((k (array unsigned-char))
    7.54@@ -398,7 +415,6 @@
    7.55     (is (null (alien-funcall (alien-callable-function 'rocksdb-delete-value) state str 1))))
    7.56 
    7.57   (is (null (alien-funcall (alien-callable-function 'rocksdb-destructor) (make-alien (* t)))))
    7.58-
    7.59   ;; null merge op
    7.60   (with-alien ((state (* t))
    7.61                (destructor (* rocksdb-destructor-function))
    7.62@@ -408,7 +424,6 @@
    7.63                (name (* rocksdb-name-function)))
    7.64     (is (typep (rocksdb-mergeoperator-create state destructor full-merge partial-merge delete-value name)
    7.65                '(alien (* rocksdb-mergeoperator)))))
    7.66-
    7.67   ;; concat merge op
    7.68   (with-alien ((state (* t))
    7.69                (destructor (* rocksdb-destructor-function) (alien-sap (alien-callable-function 'rocksdb-destructor)))
    7.70@@ -417,7 +432,13 @@
    7.71                (delete-value (* rocksdb-delete-value-function) (alien-sap (alien-callable-function 'rocksdb-delete-value)))
    7.72                (name (* rocksdb-name-function) (alien-sap (alien-callable-function 'rocksdb-concat-merge-name))))
    7.73     (is (typep (rocksdb-mergeoperator-create state destructor full-merge partial-merge delete-value name)
    7.74-               '(alien (* rocksdb-mergeoperator))))))
    7.75+               '(alien (* rocksdb-mergeoperator)))))
    7.76+  (with-opt (o (test-opts) nil)
    7.77+    (rocksdb-options-set-merge-operator o (create-dummy-mergeoperator))
    7.78+    (with-temp-db db (o)
    7.79+      ;; merge_operator=DUMMY in OPTIONS file
    7.80+      )))
    7.81+     
    7.82 
    7.83 (deftest comparator ()
    7.84   "Test low-level comparator API."
    7.85@@ -430,7 +451,12 @@
    7.86     (is (typep (rocksdb-comparator-create state destructor compare name)
    7.87                '(alien (* rocksdb-comparator))))
    7.88     (is (typep (rocksdb-comparator-with-ts-create state destructor compare compare-with-ts compare-without-ts name)
    7.89-               '(alien (* rocksdb-comparator))))))
    7.90+               '(alien (* rocksdb-comparator))))
    7.91+    ;; TODO - need to test with column-family options
    7.92+    (with-opt (o (test-opts) nil)
    7.93+      (rocksdb-options-set-comparator
    7.94+       o
    7.95+       (rocksdb-comparator-create state destructor compare name)))))
    7.96 
    7.97 (deftest compaction ()
    7.98   "Test low-level compactionfilter API."
    7.99@@ -448,13 +474,18 @@
   7.100                                                  (alien-sap (alien-callable-function
   7.101                                                              'rocksdb-create-compaction-filter-never))
   7.102                                                  (alien-sap (alien-callable-function 'rocksdb-name)))
   7.103-         '(alien (* rocksdb-compactionfilterfactory))))))
   7.104+         '(alien (* rocksdb-compactionfilterfactory)))))
   7.105+
   7.106+  ;; TODO
   7.107+  (with-opt (o (test-opts) nil)
   7.108+    (with-temp-db db (o)
   7.109+      )))
   7.110     
   7.111 (deftest logger ()
   7.112   "Test logging functionality."
   7.113   (with-alien ((state (* t))
   7.114                (lev unsigned 0)
   7.115-               (msg c-string)
   7.116+               (msg c-string "")
   7.117                (log (* rocksdb-log-function) (alien-sap (alien-callable-function 'rocksdb-log-default))))
   7.118     (is (typep
   7.119          (rocksdb-logger-create-stderr-logger lev msg)