Databasing

class dsviper.Databasing

Bases: object

An interface used to abstract the implementation of the persistence layer for a CRUD like database.

Note: Not directly instantiable.

TRANSACTION_DEFERRED = 'Deferred'
TRANSACTION_EXCLUSIVE = 'Exclusive'
TRANSACTION_IMMEDIATE = 'Immediate'
begin_transaction(mode: str | None = None) None

Begin a transaction where the mode is ‘Deferred’, ‘Immediate’ or ‘Exclusive’.

blob(blob_id: ValueBlobId) ValueBlob | None

Return a blob or None.

blob_ids() set[ValueBlobId]

Return the set of blob_id of all blobs.

blob_info(blob_id: ValueBlobId) BlobInfo | None

Return the information for the blob or None.

blob_infos(blob_ids: set[ValueBlobId]) list[BlobInfo]

Return a list of BlobInfo.

blob_statistics() BlobStatistics

Return the statistics for blobs.

blob_stream_close(stream_id: ValueUUId, blob_id: ValueBlobId) None

Close the stream.

blob_stream_create(blob_layout: BlobLayout, size: int) ValueUUId

Return the uuid of the stream.

blob_stream_delete(stream_id: ValueUUId) None

Delete the stream.

blob_stream_write(stream_id: ValueUUId, blob: ValueBlob, offset: int) None

write a region of the blob.

close() None

Close the database.

codec_name() str

Return the name of the codec.

commit() None

Commit the transaction.

create_blob(blob_layout: BlobLayout, blob: ValueBlob) ValueBlobId

Create the blob and return the blob_id.

create_zero_blob(blob_id: ValueBlobId, blob_layout: BlobLayout, size: int) bool

Return the True if the blob was created.

data_version() int

Return the data version.

definitions() DefinitionsConst

Return the definitions.

definitions_hexdigest() str

Return the definitions.

del_blob(blob_id: ValueBlobId) bool

Return True if the blob was deleted.

delete(attachment: Attachment, key: ValueKey) bool

Return True if the value was deleted.

documentation() str

Return the documentation.

extend_definitions(other: DefinitionsConst) DefinitionsExtendInfo

Extend the definitions.

freeze_blob(blob_id: ValueBlobId) bool

Return True if the blob was frozen.

get(attachment: Attachment, key: ValueKey) ValueOptional

Return an optional<document_type> associated with the key.

has(attachment: Attachment, key: ValueKey) bool

Return True if a value is present for the key.

in_transaction() bool

Return True if a transaction is running.

is_closed() bool

Return True if the database is closed.

keys(attachment: Attachment) ValueSet

Return the set of all keys.

path() str

Return the path.

read_blob(blob_id: ValueBlobId, size: int, offset: int) ValueBlob

Return the blob at offset.

rollback() None

Roll back the transaction.

set(attachment: Attachment, key: ValueKey, value: _InputValues) bool

Assigns the value to the key.

uuid() ValueUUId

Return the uuid.

write_blob(blob_id: ValueBlobId, blob: ValueBlob, offset: int) None

Write a region of the blob at offset.