CommitDatabase¶
- class dsviper.CommitDatabase(commit_databasing)¶
Bases:
objectA Commit database keeps the history of mutations in a DAG of commit.
Use the static factory method create_in_memory(), create(…), open(…), connect(…) or connect_local(…).
- blob(blob_id: ValueBlobId) ValueBlob¶
Return a blob or None.
- blob_getting() BlobGetting¶
Return the BlobGetting interface.
- blob_ids() set[ValueBlobId]¶
Return the set of blob_id of all available blobs.
- blob_info(blob_id: ValueBlobId) BlobInfo¶
Return the information of the blob.
- blob_infos(blob_ids: set[ValueBlobId]) list[BlobInfo]¶
Return a list of BlobInfo.
- blob_statistics() BlobStatistics¶
Return the statistics for blobs.
- blob_stream_append(blob_stream: BlobStream, blob: ValueBlob) None¶
Append the blob to the stream.
- blob_stream_close(blob_stream: BlobStream) ValueBlobId¶
Return the computed blob_id and close the stream.
- blob_stream_create(blob_layout: BlobLayout, size: int) BlobStream¶
Return a stream to fill a blob.
- children_commit_ids(commit_id: ValueCommitId) set[ValueCommitId]¶
Return a set of commit_id for the children of the commit.
- close() None¶
Close the database.
- codec_name() str¶
Return the name of the codec.
- commit(commit_id: ValueCommitId) Commit¶
Return the commit.
- commit_databasing() CommitDatabasing¶
Return the CommitDatabasing interface.
- commit_exists(commit_id: ValueCommitId) bool¶
Return True if the commit exists.
- commit_header(commit_id: ValueCommitId) CommitHeader¶
Return the header associated with the commit.
- commit_ids() set[ValueCommitId]¶
Return a set of commit_id for all available commits.
- commit_mutations(label: str, commit_mutable_state: CommitMutableState) ValueCommitId¶
Create a new commit and return the commit_id.
- static connect(host: str, service: str = '54321') CommitDatabase¶
Connect to a remote commit server.
- static connect_local(socket_path: str) CommitDatabase¶
Connect to a socket located at socket_path.
- static create(file_path: str, *, documentation: str | None = None) CommitDatabase¶
Create a database.
- create_blob(blob_layout: BlobLayout, blob: ValueBlob) ValueBlobId¶
Compute and return the blob_id for a blob and the layout.
- static create_in_memory() CommitDatabase¶
Create a database in memory.
- 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.
- disable_commit(label: str, parent_commit_id: ValueCommitId, disabled_commit_id: ValueCommitId) ValueCommitId¶
Return the commit_id of a new commit that disables another commit.
- documentation() str¶
Return the documentation.
- enable_commit(label: str, parent_commit_id: ValueCommitId, enabled_commit_id: ValueCommitId) ValueCommitId¶
Return the commit_id of the new commit that enables another commit.
- enabled_by_commit_id(commit_id: ValueCommitId) dict[ValueCommitId, bool]¶
Return a dict[ValueCommitId, bool].
- extend_definitions(other: DefinitionsConst) DefinitionsExtendInfo¶
Extend the definitions.
- fast_forward(commit_id: ValueCommitId) ValueCommitId¶
Return the commit_id of the most plausible head.
- first_commit_id() ValueCommitId | None¶
Return the commit_id of the first commit or None.
- forward(commit_id: ValueCommitId) ValueCommitId¶
Return the commit_id of the uniq head or fast_forward.
- head_commit_ids() set[ValueCommitId]¶
Return a set of commit_id for the available heads.
- in_memory() bool¶
Return True if the database is in memory.
- initial_state() CommitState¶
Return the initial state without any mutations.
- is_ancestor(commit_id: ValueCommitId, descendant_id: ValueCommitId) bool¶
Return True if commit_id is a descendant of descendant_id.
- is_closed() bool¶
Return True is the database is closed.
- static is_compatible(file_path: str) bool¶
Return True if the SQL schema contains the required tables.
- is_mergeable(parent_commit_id: ValueCommitId, merged_commit_id: ValueCommitId) bool¶
Return True if a merge is valid.
- last_commit_id() ValueCommitId | None¶
Return the commit_id of the last commit or None.
- merge_commit(label: str, parent_commit_id: ValueCommitId, merged_commit_id: ValueCommitId) ValueCommitId¶
Return the commit_id of the new commit that merges another commit.
- nephew_commit_ids(commit_id: ValueCommitId) set[ValueCommitId]¶
Return a set of commit_id for the nephew of the commit.
- static open(file_path: str, readonly: bool = False) CommitDatabase¶
Open a database.
- path() str¶
Return the path.
- read_blob(blob_id: ValueBlobId, size: int, offset: int) ValueBlob¶
Return a region of the blob.
- reduce_heads() None¶
Reduce to a single head by iteratively merging heads, starting from the last_commit_id and return the new commit_id or None.
- reset_commits() None¶
Remove all commits except the first one.
WARNING: It’s not a feature!, it’s a trick used during interactive presentation.
- state(commit_id: ValueCommitId) CommitState¶
Return a new state for a commit.
- stream_codec_instancing() StreamCodecInstancing¶
Return the StreamCodecInstancing interface used to encode the binary data.