Common Lisp Package: BKNR.DATASTORE

README:

FUNCTION

Public

CASCADING-DELETE-OBJECT (OBJECT)

Delete the OBJECT and all objects that reference it and that are eligible to cascading deletes, as indicated by the result of calling CASCADE-DELETE-P. Generate error if there are references to the objects that are not eligible to cascading deletes.

CHANGE-SLOT-VALUES (OBJECT &REST SLOTS-AND-VALUES)

This function is the deprecated way to set slots of persistent objects.

EXECUTE (TRANSACTION)

Interface routine to execute a transaction, called through the deftransaction macro and by subsystems. Executes the transaction either with the store or with the currently active transaction, if any.

FIND-STORE-OBJECT (ID-OR-NAME &KEY (CLASS 'STORE-OBJECT) QUERY-FUNCTION KEY-SLOT-NAME)

Mock up implementation of find-store-object API as in the old datastore. Note: QUERY-FUNCTION will only be used if ID-OR-NAME is neither an integer nor a string designating an integer.

STORE-OBJECT-TOUCH (OBJECT)

[Transaction function wrapper STORE-OBJECT-TOUCH invokes a store transaction] Update the LAST-CHANGE slot to reflect the current transaction timestamp.

TX-CHANGE-SLOT-VALUES (OBJECT &REST SLOTS-AND-VALUES)

Called by the MOP to change a persistent slot's value.

Undocumented

ALL-STORE-OBJECTS

BLOB-SUBSYSTEM

CLASS-INSTANCES (CLASS)

CLOSE-STORE

CURRENT-TRANSACTION-TIMESTAMP

DELETE-OBJECT (OBJECT)

DELETE-OBJECTS (&REST OBJECTS)

IN-TRANSACTION-P

MAKE-BLOB-FROM-FILE (PATHNAME &OPTIONAL (CLASS 'BLOB) &REST INITARGS)

MAP-STORE-OBJECTS (FUN)

OPEN-STORE (DIRECTORY &KEY (CLASS-NAME 'STORE) (SUBSYSTEMS (LIST (MAKE-INSTANCE 'STORE-OBJECT-SUBSYSTEM))))

PERSISTENT-CHANGE-CLASS (OBJECT CLASS &REST ARGS)

RESTORE (&OPTIONAL UNTIL)

SNAPSHOT

STORE-BLOB-ROOT-TEMPDIR (&OPTIONAL (STORE *STORE*))

STORE-OBJECT-ADD-KEYWORDS (OBJECT SLOT KEYWORDS)

STORE-OBJECT-REMOVE-KEYWORDS (OBJECT SLOT KEYWORDS)

STORE-OBJECT-SET-KEYWORDS (OBJECT SLOT KEYWORDS)

STORE-OBJECT-SUBSYSTEM

STORE-OBJECT-WITH-ID (KEY)

STORE-OBJECTS-WITH-CLASS (KEY)

Private

%READ-SLOTS (STREAM OBJECT SLOTS)

Read the OBJECT from STREAM. The individual slots of the object are expected in the order of the list SLOTS. If the OBJECT is NIL, the slots are read from the snapshot and ignored.

FIND-DOC (BODY)

Given a function definition BODY, extract the docstring, if any. Skips over any declarations that precede the docstring. See also CLHS 3.4.11

INSERT-AFTER-DECLARATIONS (BODY FORMS-TO-INSERT)

Given a function definition body, insert FORMS-TO-INSERT after all declarations and documentation in BODY.

MAKE-ARGS (ARGS)

Parse the lambda list ARGS, returning a list that contains the arguments in the lambda list prepared so that the list can be applied to a function accepting that lambda list. For example: (MAKE-ARGS '(A B &OPTIONAL C &REST D &KEY E F)) => (A B C :E E :F F) It is used to forward arguments to a transaction wrapper generated by DEFTRANSACTION to the actual transaction so that the wrapper function can be declared with the lambda list of the transaction function itself,

MAKE-BACKUP-DIRECTORY (STORE)

Create directory pathname to place backup for STORE in. By default, the current time stamp is used. If that directory already exists, attach a dot and an incrementing number to the directory pathname until a non-existant directory name has been found.

PARTITION-LIST (LIST PREDICATE)

Return two list values, the first containing all elements from LIST that satisfy PREDICATE, the second those that don't

QUOTE-META-CHARS (STRING &KEY (START 0) (END (LENGTH STRING)))

Quote, i.e. prefix with #\\, all non-word characters in STRING.

TX-STORE-OBJECT-TOUCH (OBJECT)

Update the LAST-CHANGE slot to reflect the current transaction timestamp.

Undocumented

%DECODE-ARRAY (STREAM)

%DECODE-CHAR (STREAM)

%DECODE-DOUBLE-FLOAT (STREAM)

%DECODE-HASH-TABLE (STREAM)

%DECODE-INTEGER (STREAM)

%DECODE-INTEGER/FIXED (STREAM N)

%DECODE-LIST (STREAM)

%DECODE-RATIONAL (STREAM)

%DECODE-SINGLE-FLOAT (STREAM)

%DECODE-SINT32 (STREAM)

%DECODE-STORE-OBJECT (STREAM)

%DECODE-STRING (STREAM)

%DECODE-SYMBOL (STREAM &KEY (INTERN T) USAGE)

%DECODE-UINT16 (STREAM)

%DECODE-UINT32 (STREAM)

%ENCODE-ARRAY (OBJECT STREAM)

%ENCODE-DOUBLE-FLOAT (OBJECT STREAM)

%ENCODE-INT16 (OBJECT STREAM)

%ENCODE-INT32 (OBJECT STREAM)

%ENCODE-INTEGER (OBJECT STREAM)

%ENCODE-LIST (OBJECT STREAM)

%ENCODE-RATIONAL (OBJECT STREAM)

%ENCODE-SET-SLOTS (SLOTS OBJECT STREAM)

%ENCODE-SINGLE-FLOAT (OBJECT STREAM)

%ENCODE-STRING (OBJECT STREAM)

%ENCODE-SYMBOL (OBJECT STREAM)

%READ-CHAR (STREAM)

%READ-TAG (STREAM &OPTIONAL (EOF-ERROR-P T) EOF-VALUE)

%WRITE-CHAR (CHAR STREAM)

%WRITE-TAG (CHAR STREAM)

ALL-STORE-CLASSES

ALLOCATE-NEXT-OBJECT-ID

ANONYMOUS-TRANSACTION-UNDO (TRANSACTION)

BLOBS-WITH-TYPE (KEY)

COUNT-CONSES (LIST)

DECODE (STREAM)

DELETE-ORPHANED-BLOB-FILES (&OPTIONAL (COLD-RUN T))

DO-WITH-TRANSACTION (LABEL THUNK)

ENCODE (OBJECT STREAM)

ENCODE-ARRAY (OBJECT STREAM)

ENCODE-CHAR (OBJECT STREAM)

ENCODE-CREATE-OBJECT (CLASS-LAYOUTS OBJECT STREAM)

ENCODE-CURRENT-OBJECT-ID (STREAM)

ENCODE-DOUBLE-FLOAT (OBJECT STREAM)

ENCODE-HASH-TABLE (OBJECT STREAM)

ENCODE-INTEGER (OBJECT STREAM)

ENCODE-LAYOUT (ID CLASS SLOTS STREAM)

ENCODE-LIST (OBJECT STREAM)

ENCODE-RATIONAL (OBJECT STREAM)

ENCODE-SET-SLOTS (CLASS-LAYOUTS OBJECT STREAM)

ENCODE-SINGLE-FLOAT (OBJECT STREAM)

ENCODE-STRING (OBJECT STREAM)

ENCODE-SYMBOL (OBJECT STREAM)

FIND-CLASS-SLOTS-WITH-INTERACTIVE-RENAMING (CLASS SLOT-NAMES)

FIND-CLASS-WITH-INTERACTIVE-RENAMING (CLASS-NAME)

FIND-SLOT-NAME-WITH-AUTOMATIC-RENAME (CLASS SLOT-NAME)

FIND-SLOT-NAME-WITH-INTERACTIVE-RENAME (CLASS SLOT-NAME)

FIND-SYMBOL-IN-ALL-PACKAGES (NAME)

FIND-SYMBOL-INTERACTIVELY (PACKAGE-NAME SYMBOL-NAME USAGE)

FSYNC (STREAM)

INITIALIZE-STORE-RANDOM-STATE (STORE)

INITIALIZE-TRANSIENT-SLOTS (OBJECT)

LOAD-TRANSACTION-LOG (PATHNAME &KEY UNTIL)

MAKE-SINGLE-FLOAT (BITS)

RENAME-SLOT (CLASS SLOT-NAME)

REPORT-PROGRESS (FMT &REST ARGS)

SNAPSHOT-READ-LAYOUT (STREAM LAYOUTS)

SNAPSHOT-READ-OBJECT (STREAM LAYOUTS)

SNAPSHOT-READ-SLOTS (STREAM LAYOUTS)

STORE-BLOB-ROOT-PATHNAME (&OPTIONAL (STORE *STORE*))

STORE-CURRENT-TRANSACTION

STORE-OPEN-P

TRUNCATE-LOG (PATHNAME POSITION)

TX-DELETE-OBJECT (ID)

TX-DELETE-OBJECTS (&REST OBJECT-IDS)

TX-PERSISTENT-CHANGE-CLASS (OBJECT CLASS-NAME &REST ARGS)

TX-STORE-OBJECT-ADD-KEYWORDS (OBJECT SLOT KEYWORDS)

TX-STORE-OBJECT-REMOVE-KEYWORDS (OBJECT SLOT KEYWORDS)

TX-STORE-OBJECT-SET-KEYWORDS (OBJECT SLOT KEYWORDS)

TX-UPDATE-INSTANCES-FOR-CHANGED-CLASS (CLASS)

UNDO-SET-SLOT (OBJECT SLOT-NAME VALUE)

UPDATE-INSTANCES-FOR-CHANGED-CLASS (CLASS)

MACRO

Public

DEFTRANSACTION (NAME (&REST ARGS) &REST BODY)

Define a transaction function tx-NAME and a function NAME executing tx-NAME in the context of the current store. The arguments to NAME will be serialized to the transaction-log, and must be supported by the binary encoder. tx-NAME will be called during a roll-forward to repeat any effects that the transaction function had on the persistent store.

WITH-STORE-GUARD ((&OPTIONAL (STORE '*STORE*)) &REST BODY)

Execute BODY in the context of the guard of STORE.

Undocumented

DEFINE-PERSISTENT-CLASS (CLASS (&REST SUPERCLASSES) SLOTS &REST CLASS-OPTIONS)

DEFPERSISTENT-CLASS (CLASS (&REST SUPERCLASSES) SLOTS &REST CLASS-OPTIONS)

WITH-JSON-IGNORE-SLOTS ((&REST SLOTS) &BODY BODY)

WITH-OPEN-BLOB ((S BLOB &REST ARGS) &REST BODY)

WITH-TRANSACTION ((&OPTIONAL LABEL) &BODY BODY)

Private

WITH-LOG-GUARD ((&OPTIONAL (STORE '*STORE*)) &REST BODY)

Execute BODY in the context of the log file guard of STORE.

Undocumented

WITH-STORE ((STORE &KEY) &BODY BODY)

WITH-STORE-STATE ((STATE &OPTIONAL (STORE '*STORE*)) &REST BODY)

WITH-TRANSACTION-LOG ((TRANSACTION) &BODY BODY)

WITHOUT-SYNC (NIL &BODY BODY)

GENERIC-FUNCTION

Public

CASCADE-DELETE-P (OBJECT REFERENCING-OBJECT)

return non-nil if the REFERENCING-OBJECT should be deleted when the OBJECT is deleted

CONVERT-SLOT-VALUE-WHILE-RESTORING (OBJECT SLOT-NAME VALUE)

Generic function to be called to convert a slot's value from a previous snapshot layout. OBJECT is the object that is being restored, SLOT-NAME is the name of the slot in the old schema, VALUE is the value of the slot in the old schema.

INITIALIZE-TRANSIENT-INSTANCE (STORE-OBJECT)

Initializes the transient aspects of a persistent object. This method is called after a persistent object has been initialized, also when the object is loaded from a snapshot, but before reading the transaction log.

PREPARE-FOR-SNAPSHOT (OBJECT)

Called for every store object before a snapshot is written.

STORE-OBJECT-LAST-CHANGE (OBJECT DEPTH)

Return the last change time of the OBJECT. DEPTH determines how deep the object graph will be traversed.

Undocumented

BLOB-FROM-ARRAY (BLOB ARRAY)

BLOB-FROM-FILE (BLOB PATHNAME)

BLOB-FROM-STREAM (BLOB STREAM)

BLOB-FROM-STRING (BLOB STRING)

BLOB-PATHNAME (BLOB-OR-BLOB-ID)

BLOB-SIZE (BLOB)

BLOB-TO-FILE (BLOB PATHNAME)

BLOB-TO-STREAM (BLOB S)

ENSURE-STORE-CURRENT-DIRECTORY (STORE)

FIND-REFS (OBJECT)

INITIALIZE-SUBSYSTEM (SUBSYSTEM STORE STORE-EXISTED-P)

RENAME-FILE-TO-BLOB (BLOB PATHNAME)

RESTORE-SUBSYSTEM (STORE SUBSYSTEM &KEY UNTIL)

SNAPSHOT-SUBSYSTEM (STORE SUBSYSTEM)

Private

EXECUTE-TRANSACTION (EXECUTOR TRANSACTION)

Execute TRANSACTION on EXECUTOR (which may be a store or a transaction scope).

EXECUTE-UNLOGGED (TRANSACTION)

Invokes the transaction application code by calling the function named by the transactions' function-symbol. Called at transaction execution and restore time within different environment. May be overridden by specialized transaction types, e.g. the anonymous transaction which writes a set of transactions to the log file in an atomic group

RELAXED-OBJECT-REFERENCE-SLOT-P (SLOTD)

Return whether the given slot definition specifies that the slot is relaxed. If a relaxed slot holds a pointer to another persistent object and the pointed-to object is deleted, slot reads will return nil.

STORE-CURRENT-DIRECTORY (STORE)

Returns the name of the current datastore directory.

STORE-SUBSYSTEM-SNAPSHOT-PATHNAME (STORE-OR-DIRECTORY SUBSYSTEM)

Return the pathname of the snapshot of SUBSYSTEM of STORE

STORE-TRANSACTION-LOG-PATHNAME (STORE-OR-DIRECTORY)

Return the pathname of the current transaction log of STORE

Undocumented

ARGUMENT (CONDITION)

BLOB-RELATIVE-PATHNAME (ID)

CLASS-PERSISTENT-SLOTS (CLASS)

CLOSE-STORE-OBJECT (STORE)

CLOSE-SUBSYSTEM (STORE SUBSYSTEM)

CLOSE-TRANSACTION-LOG-STREAM (STORE)

DECODE-OBJECT (TAG STREAM)

ENCODE-OBJECT (OBJECT STREAM)

ENSURE-STORE-RANDOM-STATE (STORE)

IN-ANONYMOUS-TRANSACTION-P

OPTION (CONDITION)

RESTORE-STORE (STORE &KEY UNTIL)

SNAPSHOT-STORE (STORE)

STORE-OBJECT-PERSISTENT-SLOTS (OBJECT)

STORE-OBJECT-RELAXED-OBJECT-REFERENCE-P (OBJECT SLOT-NAME)

STORE-RANDOM-STATE-PATHNAME (STORE)

TRANSIENT-SLOT-P (SLOTD)

TX-NAME (CONDITION)

UPDATE-STORE-RANDOM-STATE (STORE)

SLOT-ACCESSOR

Public

STORE-STATE (OBJECT)

State of the datastore, can be either :closed, :opened or :read-only

SETFSTORE-STATE (NEW-VALUE OBJECT)

State of the datastore, can be either :closed, :opened or :read-only

TRANSACTION-FUNCTION-SYMBOL (OBJECT)

Symbol of the function called when executing the transaction

Undocumented

BLOB-MIME-TYPE (OBJECT)

BLOB-TIMESTAMP (OBJECT)

BLOB-TYPE (OBJECT)

STORE-GUARD (OBJECT)

STORE-OBJECT-ID (OBJECT)

TRANSACTION-ARGS (OBJECT)

TRANSACTION-TIMESTAMP (OBJECT)

SETFTRANSACTION-TIMESTAMP (NEW-VALUE OBJECT)

Private

N-BLOBS-PER-DIRECTORY (OBJECT)

The number of blobs to store in each subdirectory of blob-root. If this is NIL, do not create subdirectories. This parameter must be specified when the when the store is created and is stored in the datastore root to ensure that the correct value is used later.

SETFN-BLOBS-PER-DIRECTORY (NEW-VALUE OBJECT)

The number of blobs to store in each subdirectory of blob-root. If this is NIL, do not create subdirectories. This parameter must be specified when the when the store is created and is stored in the datastore root to ensure that the correct value is used later.

NEXT-OBJECT-ID (OBJECT)

Next object ID to assign to a new object

SETFNEXT-OBJECT-ID (NEW-VALUE OBJECT)

Next object ID to assign to a new object

STORE-TRANSACTION-RUN-TIME (OBJECT)

The total run time of all application transaction code since last snapshot

SETFSTORE-TRANSACTION-RUN-TIME (NEW-VALUE OBJECT)

The total run time of all application transaction code since last snapshot

Undocumented

ANONYMOUS-TRANSACTION-LABEL (OBJECT)

SETFANONYMOUS-TRANSACTION-LABEL (NEW-VALUE OBJECT)

ANONYMOUS-TRANSACTION-LOG-BUFFER (OBJECT)

SETFANONYMOUS-TRANSACTION-LOG-BUFFER (NEW-VALUE OBJECT)

ANONYMOUS-TRANSACTION-UNDO-LOG (OBJECT)

SETFANONYMOUS-TRANSACTION-UNDO-LOG (NEW-VALUE OBJECT)

STORE-DIRECTORY (OBJECT)

SETFSTORE-DIRECTORY (NEW-VALUE OBJECT)

STORE-LOG-GUARD (OBJECT)

STORE-RANDOM-STATE (OBJECT)

SETFSTORE-RANDOM-STATE (NEW-VALUE OBJECT)

STORE-SUBSYSTEMS (OBJECT)

STORE-TRANSACTION-LOG-STREAM (STORE)

SETFSTORE-TRANSACTION-LOG-STREAM (NEW-VALUE OBJECT)

VARIABLE

Public

*STORE-DEBUG*

Trace and time execution of transactions

Undocumented

*JSON-IGNORE-SLOTS*

Private

*TXN-LOG-STREAM*

This variable is bound to the transaction log stream while loading the transaction log. It is used by anonymous transactions to read the subtransactions from the log.

Undocumented

*ALLOCATE-OBJECT-ID-LOCK*

*CURRENT-OBJECT-SLOT*

*CURRENT-SLOT-RELAXED-P*

*CURRENT-TRANSACTION*

*DISABLE-SYNC*

*SHOW-TRANSACTIONS*

*STORE-VERBOSE*

*SUPPRESS-SCHEMA-WARNINGS*

*TRANSACTION-STATISTICS*

CLASS

Public

MP-STORE

Store in which every transaction and operation is protected by a giant lock.

Undocumented

BLOB

BLOB-SUBSYSTEM

PERSISTENT-CLASS

STORE

STORE-OBJECT

STORE-OBJECT-SUBSYSTEM

TRANSACTION

Private

Undocumented

ANONYMOUS-TRANSACTION

ARRAY-INDEX

PERSISTENT-DIRECT-SLOT-DEFINITION

PERSISTENT-EFFECTIVE-SLOT-DEFINITION

CONDITION

Private

ANONYMOUS-TRANSACTION-IN-TRANSACTION

Signaled when an anonymous transaction is started from within another transaction, transactions do not nest.

DEFAULT-ARGUMENTS-UNSUPPORTED

Signaled when an argument in a DEFTRANSACTION definition has a default declaration

INVALID-STORE-RANDOM-STATE

Signaled when the on-disk store random state cannot be read, typically because it has been written with another Lisp

INVALID-TRANSACTION-NESTING

Signaled when WITH-TRANSACTION forms are nested.

NO-SUBSYSTEMS

Signaled when an attempt is made to snapshot a store without subsystems

NOT-IN-TRANSACTION

Signaled when an operation on persistent slots is executed outside a transaction context

STORE-ALREADY-OPEN

Signaled when an attempt is made to open a store with another store being open

STORE-NOT-OPEN

Signaled when a transaction is executed on a store that is not opened

TRANSIENT-SLOT-CANNOT-HAVE-INITARG

A transient slot may not have an :initarg specified, as initialize-instance is only used for persistent initialization.

UNDEFINED-TRANSACTION

Signaled when a named transaction is loaded from the transaction log and no matching function definition could be found

UNSUPPORTED-LAMBDA-LIST-OPTION

Signaled when DEFTRANSACTION is used with an unsupported option in its lambda list

Undocumented

INCONSISTENT-SLOT-PERSISTENCE-DEFINITION

INVALID-ENVIRONMENT-ACCESS

INVALID-REFERENCE

OBJECT-SUBSYSTEM-NOT-FOUND-IN-STORE

PERSISTENT-SLOT-MODIFIED-OUTSIDE-OF-TRANSACTION

ROLLBACK-FAILED

STORE-ERROR