1.1--- a/lisp/lib/rdb/raw.lisp Thu Sep 26 21:16:45 2024 -0400
1.2+++ b/lisp/lib/rdb/raw.lisp Fri Sep 27 20:19:10 2024 -0400
1.3@@ -16,6 +16,10 @@
1.4 (make-rocksdb-options
1.5 (lambda (o) (rocksdb-options-set-create-if-missing o t))))
1.6
1.7+(defun load-opts-raw (dir)
1.8+ (rocksdb::with-latest-options dir (db-opts names cf-opts)
1.9+ (values db-opts names cf-opts)))
1.10+
1.11 (defun get-stats-raw (opt htype)
1.12 (with-alien ((hist (* rocksdb-statistics-histogram-data) (rocksdb-statistics-histogram-data-create)))
1.13 (rocksdb-options-statistics-get-histogram-data opt htype hist)
1.14@@ -116,9 +120,17 @@
1.15 (when v (octets-to-string v)))))
1.16
1.17 ;;; Column Family
1.18-(defun open-cf-raw (db name &optional (opt (rocksdb-options-create)))
1.19- (with-errptr (err 'rocksdb-cf-error (list :db db :cf name))
1.20- (rocksdb-open-column-families opt name 1 nil nil nil err)))
1.21+(defun open-cfs-raw (db-opt name names opts)
1.22+ (let ((n (length names)))
1.23+ (with-alien ((cf-names (* c-string) (clone-strings names))
1.24+ (cf-opts (* (* rocksdb-options)))
1.25+ (cf-handles (* (* rocksdb-column-family-handle))))
1.26+ (loop for opt in opts
1.27+ for i below n
1.28+ do (setf (deref cf-opts i) opt))
1.29+ (with-errptr (err 'rocksdb-cf-error (list :cf name))
1.30+ (let ((db (rocksdb-open-column-families db-opt name n cf-names cf-opts cf-handles err)))
1.31+ (values db cf-handles))))))
1.32
1.33 (defun create-cf-raw (db name &optional (opt (rocksdb-options-create)))
1.34 (with-errptr (err 'rocksdb-cf-error (list :db db :cf name))
1.35@@ -170,6 +182,12 @@
1.36 (val-octets (string-to-octets val :null-terminate nil)))
1.37 (put-cf-raw db cf key-octets val-octets opt)))
1.38
1.39+(defun cf-name-raw (cf-handle)
1.40+ (rocksdb-column-family-handle-get-name cf-handle (make-alien unsigned-long)))
1.41+
1.42+(defun cf-id-raw (cf-handle)
1.43+ (rocksdb-column-family-handle-get-id cf-handle))
1.44+
1.45 ;;; Iterators
1.46 (defun create-iter-raw (db &optional (opt (rocksdb-readoptions-create)))
1.47 (rocksdb-create-iterator db opt))