Mercurial > core / lisp/lib/rdb/proto.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
5f88b237ce29
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; rdb/proto.lisp --- RDB protocol 3 ;; Extends OBJ/DB protocol with RocksDB-specific generics. 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 load-opts (self) 28 (:documentation "Load existing database options. Assumes that the database has been opened and 29 flushed to disk at least once.")) 30 (defgeneric push-sap (self key) 31 (:documentation "Push a value associated with KEY to the sap associated 32 with SELF. Typically used to send a value from one slot, to a foreign 33 handle stored in another slot of the same object.")) 34 (defgeneric push-sap* (self) 35 (:documentation "Implicitly push values to the sap associated with SELF.")) 36 (defgeneric pull-sap (self key) 37 (:documentation "Pull a foreign value identified by KEY from the sap associated with SELF.")) 38 (defgeneric pull-sap* (self) 39 (:documentation "Implicitly pull foreign values from the sap associated with SELF.")) 40 (defgeneric push-cf (cf self) 41 (:documentation "Push a column-family to a sap.")) 42 (defgeneric open-cfs (self &rest names) 43 (:documentation "Open the column-families indicated by NAMES or all column-fmailies belonging 45 (defgeneric close-cf (self &optional error) 46 (:documentation "Close the column-family SELF. When ERROR is non-nil signal an error if the 47 column-family is already closed.")) 48 (defgeneric close-cfs (self) 49 (:documentation "Close the column-families belonging to SELF.")) 50 (defgeneric insert-key (self key val &key) 51 (:documentation "Insert KEY:VAL into SELF.")) 52 (defgeneric insert-kv (self kv &key) 53 (:documentation "Insert KV object into SELF.")) 54 (defgeneric make-kv (key val) 55 (:documentation "Make a KV object from KEY:VAL.")) 56 (defgeneric delete-key (self key &key) 57 (:documentation "Delete value associated with KEY from SELF.")) 58 (defgeneric delete-key-ts (self key ts) 59 (:documentation "Delete value associated with KEY and TS from SELF.")) 60 (defgeneric delete-key-range (self start end &key) 61 (:documentation "Delete values associates with keys between START and END from SELF.")) 62 (defgeneric make-transaction (self &key) 63 (:documentation "Make a new transaction object from SELF.")) 64 (defgeneric begin-transaction (self &key) 65 (:documentation "Begin processing of transaction SELF.")) 66 (defgeneric prepare-transaction (self &key) 67 (:documentation "Prepare transaction SELF.")) 68 (defgeneric rollback-transaction (self &key) 69 (:documentation "Rollback transaction SELF.")) 70 (defgeneric delete-transaction (self) 71 (:documentation "Delete transaction SELF.")) 72 (defgeneric commit-transaction (self &key) 73 (:documentation "Commit transaction object SELF.")) 74 (defgeneric flush-db (self &key) 75 (:documentation "Flush the database SELF.")) 76 (defgeneric sync-db (self other &key) ;;nyi 77 (:documentation "Perform a synchronization on SELF using OTHER.")) 78 (defgeneric find-cf (cf self &key) 79 (:documentation "Find the column-familiy CF in SELF.")) 80 (defgeneric flush-cf (self cf &key) 81 (:documentation "Flush the column-family CF in SELF.")) 82 (defgeneric repair-db (self &key) 83 (:documentation "Attempt to repair the database SELF.")) 84 (defgeneric backup-db (self &key) 85 (:documentation "Create a new backup for database SELF.")) 86 (defgeneric restore-db (self from &key) 87 (:documentation "Restore database SELF from object FROM.")) 88 (defgeneric snapshot-db (self) 89 (:documentation "Create a new snapshot for database SELF.")) 90 (defgeneric write-db (self batch &key) 91 (:documentation "Write BATCH to database SELF.")) 92 (defgeneric shutdown-db (self &key) 93 (:documentation "Shutdown database SELF.")) 94 (defgeneric ingest-db (self file &key) 95 (:documentation "Ingest an external file into the database")) 96 (defgeneric get-prop (self propname) 97 (:documentation "Get the property-value of PROPNAME from SELF.")) 98 (defgeneric get-stats (self &optional htype) 99 (:documentation "Get stats modulo HTYPE from SELF.")) 100 (defgeneric print-stats (self &optional stream) 101 (:documentation "Print statistics data from SELF.")) 102 (defgeneric get-metadata (self &optional arg) 103 (:documentation "Get metadata from SELF modulo ARG.")) 104 (defgeneric create-iter (self &optional cf opts) 105 (:documentation "Create an interator over the kvs of SELF module CF and OPTS.")) 106 (defgeneric iter-next (self) 107 (:documentation "Return the next value.")) 108 (defgeneric iter-prev (self) 109 (:documentation "Return the previous value.")) 110 (defgeneric iter-seek (self key &key) 111 (:documentation "Seek to a certain KEY in the iterator.")) 112 (defgeneric iter-val (self) 113 (:documentation "Return the value of current iterator item.")) 114 (defgeneric iter-valid-p (self) 115 (:documentation "Return non-nil if the iterator cursor is valid.")) 116 (defgeneric iter-key (self) 117 (:documentation "Return the key of current iterator item.")) 118 (defgeneric iter-kv (self) 119 (:documentation "Return the current KV object of the iterator by getting the key and 121 (defgeneric iter-timestamp (self) 122 (:documentation "Return the timestamp of current iterator item.")) 123 (defgeneric make-val (val) 124 (:documentation "Coerce VAL into an OCTET-VECTOR.") 125 (:method ((val null)) 127 (:method ((val string)) 128 (string-to-octets val)) 132 (defgeneric make-key (key) 133 (:documentation "Coerce KEY into an OCTET-VECTOR.") 134 (:method ((val null)) 136 (:method ((val string)) 137 (string-to-octets val)) 141 (defgeneric merge-key (self key val &key) 142 (:documentation "Perform a merge operation on SELF using KEY and VAL.")) 144 (defgeneric merge-kv (self kv &key) 145 (:documentation "Perform a merge operation on SELF using object KV."))