changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/rdb/proto.lisp

changeset 679: 12287fab15d0
parent: 97dd03beda03
child: 5f88b237ce29
author: Richard Westhaver <ellis@rwest.io>
date: Thu, 26 Sep 2024 21:16:45 -0400
permissions: -rw-r--r--
description: rocksdb load opts and env updates
1 ;;; rdb/proto.lisp --- RDB protocol
2 
3 ;; Extends OBJ/DB protocol with RocksDB-specific generics.
4 
5 ;;; Code:
6 (in-package :rdb)
7 
8 ;; Most methods are intended to work with the RDB struct directly
9 (defgeneric put-kv (self kv)
10  (:documentation "Insert a KeyVal object."))
11 (defgeneric put-key (self key val)
12  (:documentation "Insert a KEY and VAL."))
13 (defgeneric put-key-ts (self key val ts)
14  (:documentation "Insert a KEY and VAL with associated timestamp TS."))
15 (defgeneric get-key (self key &key)
16  (:documentation "Get value of KEY."))
17 (defgeneric multi-get (self keys &key)
18  (:documentation "Retrieve multiple KEYS from SELF."))
19 (defgeneric get-opt (self key)
20  (:documentation "Get value of option KEY."))
21 (defgeneric set-opt (self key val &key)
22  (:documentation "Set value of option KEY to VAL."))
23 (defgeneric push-opts (self)
24  (:documentation "Push all options to internal sap."))
25 (defgeneric backfill-opts (self &key)
26  (:documentation "Backfill opts from an alien."))
27 (defgeneric push-sap (self key)
28  (:documentation "Push a value associated with KEY to the sap associated
29 with SELF. Typically used to send a value from one slot, to a foreign
30 handle stored in another slot of the same object."))
31 (defgeneric push-sap* (self)
32  (:documentation "Implicitly push values to the sap associated with SELF."))
33 (defgeneric pull-sap (self key)
34  (:documentation "Pull a foreign value identified by KEY from the sap associated with SELF."))
35 (defgeneric pull-sap* (self)
36  (:documentation "Implicitly pull foreign values from the sap associated with SELF."))
37 (defgeneric push-cf (cf self)
38  (:documentation "Push a column-family to a sap."))
39 (defgeneric open-cf (self cf &optional opts)
40  (:documentation "Open column-family CF in SELF. When ERROR is non-nil signal an error if the
41 column-family is already open."))
42 (defgeneric open-cfs (self)
43  (:documentation "Open all column-fmailies belonging to SELF."))
44 (defgeneric close-cf (self &optional error)
45  (:documentation "Close the column-family SELF. When ERROR is non-nil signal an error if the
46 column-family is already closed."))
47 (defgeneric close-cfs (self)
48  (:documentation "Close the column-families belonging to SELF."))
49 (defgeneric insert-key (self key val &key)
50  (:documentation "Insert KEY:VAL into SELF."))
51 (defgeneric insert-kv (self kv &key)
52  (:documentation "Insert KV object into SELF."))
53 (defgeneric make-kv (key val)
54  (:documentation "Make a KV object from KEY:VAL."))
55 (defgeneric delete-key (self key &key)
56  (:documentation "Delete value associated with KEY from SELF."))
57 (defgeneric delete-key-ts (self key ts)
58  (:documentation "Delete value associated with KEY and TS from SELF."))
59 (defgeneric delete-key-range (self start end &key)
60  (:documentation "Delete values associates with keys between START and END from SELF."))
61 (defgeneric make-transaction (self &key)
62  (:documentation "Make a new transaction object from SELF."))
63 (defgeneric begin-transaction (self &key)
64  (:documentation "Begin processing of transaction SELF."))
65 (defgeneric prepare-transaction (self &key)
66  (:documentation "Prepare transaction SELF."))
67 (defgeneric rollback-transaction (self &key)
68  (:documentation "Rollback transaction SELF."))
69 (defgeneric delete-transaction (self)
70  (:documentation "Delete transaction SELF."))
71 (defgeneric commit-transaction (self &key)
72  (:documentation "Commit transaction object SELF."))
73 (defgeneric flush-db (self &key)
74  (:documentation "Flush the database SELF."))
75 (defgeneric sync-db (self other &key) ;;nyi
76  (:documentation "Perform a synchronization on SELF using OTHER."))
77 (defgeneric find-cf (cf self &key)
78  (:documentation "Find the column-familiy CF in SELF."))
79 (defgeneric flush-cf (self cf &key)
80  (:documentation "Flush the column-family CF in SELF."))
81 (defgeneric repair-db (self &key)
82  (:documentation "Attempt to repair the database SELF."))
83 (defgeneric backup-db (self &key)
84  (:documentation "Create a new backup for database SELF."))
85 (defgeneric restore-db (self from &key)
86  (:documentation "Restore database SELF from object FROM."))
87 (defgeneric snapshot-db (self)
88  (:documentation "Create a new snapshot for database SELF."))
89 (defgeneric write-db (self batch &key)
90  (:documentation "Write BATCH to database SELF."))
91 (defgeneric shutdown-db (self &key)
92  (:documentation "Shutdown database SELF."))
93 (defgeneric ingest-db (self file &key)
94  (:documentation "Ingest an external file into the database"))
95 (defgeneric get-prop (self propname)
96  (:documentation "Get the property-value of PROPNAME from SELF."))
97 (defgeneric get-stats (self &optional htype)
98  (:documentation "Get stats modulo HTYPE from SELF."))
99 (defgeneric print-stats (self &optional stream)
100  (:documentation "Print statistics data from SELF."))
101 (defgeneric get-metadata (self &optional arg)
102  (:documentation "Get metadata from SELF modulo ARG."))
103 (defgeneric create-iter (self &optional cf opts)
104  (:documentation "Create an interator over the kvs of SELF module CF and OPTS."))
105 (defgeneric iter-next (self)
106  (:documentation "Return the next value."))
107 (defgeneric iter-prev (self)
108  (:documentation "Return the previous value."))
109 (defgeneric iter-seek (self key &key)
110  (:documentation "Seek to a certain KEY in the iterator."))
111 (defgeneric iter-val (self)
112  (:documentation "Return the value of current iterator item."))
113 (defgeneric iter-valid-p (self)
114  (:documentation "Return non-nil if the iterator cursor is valid."))
115 (defgeneric iter-key (self)
116  (:documentation "Return the key of current iterator item."))
117 (defgeneric iter-kv (self)
118  (:documentation "Return the current KV object of the iterator by getting the key and
119 val."))
120 (defgeneric iter-timestamp (self)
121  (:documentation "Return the timestamp of current iterator item."))
122 (defgeneric make-val (val)
123  (:documentation "Coerce VAL into an OCTET-VECTOR.")
124  (:method ((val null))
125  #())
126  (:method ((val string))
127  (string-to-octets val))
128  (:method ((val t))
129  val))
130 
131 (defgeneric make-key (key)
132  (:documentation "Coerce KEY into an OCTET-VECTOR.")
133  (:method ((val null))
134  #())
135  (:method ((val string))
136  (string-to-octets val))
137  (:method ((val t))
138  val))
139 
140 (defgeneric merge-key (self key val &key)
141  (:documentation "Perform a merge operation on SELF using KEY and VAL."))
142 
143 (defgeneric merge-kv (self kv &key)
144  (:documentation "Perform a merge operation on SELF using object KV."))