CommitDatabasing

class dsviper.CommitDatabasing

Bases: object

An interface used to abstract the implementation of the persistence layer for a Commit database. This is a low-level interface (a driver) and requires a deep understanding of Commit to be used correctly.

Note: Not directly instantiable.

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_datas(blob_ids: set[ValueBlobId]) list[BlobData]

Return a list of BlobData.

blob_ids() set[ValueBlobId]

Return a set of blob_id for all available blobs.

blob_info(blob_id: ValueBlobId) BlobInfo | None

Return the information of a blob.

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.

children_commit_ids(commit_id: ValueCommitId) set[ValueCommitId]

Return the set of commit_id for the children of the commit.

close() None

Close the connection.

codec_name() str

Return the name of the codec.

commit() None

Commit the transaction.

commit_data(commit_id: ValueCommitId) CommitData | None

Return a CommitData or None.

commit_datas(commit_ids: set[ValueCommitId] | None = None) list[CommitData]

Return the list of CommitData.

commit_exists(commit_id: ValueCommitId) bool

Return True if the commit exists.

commit_header(commit_id: ValueCommitId) CommitHeader

Return the header of the commit associated with the commit_id.

commit_ids() set[ValueCommitId]

Return the set of commit_ids.

create_blob(blob_id: ValueBlobId, blob_layout: BlobLayout, blob: ValueBlob) bool

Create a blob.

create_blobs(blob_datas: list[BlobData]) set[ValueBlobId]

Create blobs from a list of BlobDatas and return a set of blob_id.

create_commit_data(commit_data: CommitData) bool

Create a commit if not present or return False.

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 hexdigest of the definitions.

delete_commit(commit_id: ValueCommitId) None

Delete a commit.

WARNING: It’s not a feature!, it’s a trick used during interactive presentation.

documentation() str

Return the documentation.

extend_definitions(other: DefinitionsConst) DefinitionsExtendInfo

Extend the definitions.

first_commit_id() ValueCommitId | None

Return the commit_id of the first commit or None.

freeze_blob(blob_id: ValueBlobId) bool

Return True if the blob was frozen.

head_commit_ids() set[ValueCommitId]

Return the set of commit_id for the heads.

in_transaction() bool

Return True if a transaction is running.

is_closed() bool

Return True is the connection to the database is closed.

last_commit_id() ValueCommitId | None

Return the commit_id of the last commit or None.

nephew_commit_ids(commit_id: ValueCommitId) set[ValueCommitId]

Return the set of commit_id for the nephew of the commit.

path() str

Return the path.

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

Return the blob at offset.

reset_commits() None

Remove all commits except the first one.

WARNING: It’s not a feature!, it’s a trick used during interactive presentation.

rollback() None

Roll back the transaction.

sync_data(commit_ids: set[ValueCommitId]) CommitSyncData

Return a CommitSyncData.

unknown_blob_ids(blob_ids: set[ValueBlobId]) set[ValueBlobId]

Return a set of blob_id for all unknown blobId found in blob_ids.

uuid() ValueUUId

Return the uuid.

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

Write a blob at offset.