pub struct Engine<T, L> { /* private fields */ }Expand description
Share clones of this handle across threads. All writes must use its sessions; opening multiple independent writers on the same log is not supported.
Implementations§
Source§impl<T: LinkReference, P: TransitionLogStore> Engine<T, P>
impl<T: LinkReference, P: TransitionLogStore> Engine<T, P>
Sourcepub fn fork<L: TransitionLogStore>(
&self,
log: L,
options: EngineOptions,
) -> Result<Branch<T, P, L>, LinkError>
pub fn fork<L: TransitionLogStore>( &self, log: L, options: EngineOptions, ) -> Result<Branch<T, P, L>, LinkError>
Seed an empty independent log with a flushed copy of the current state. Branch addresses are independent; divergent allocation collisions conflict.
Sourcepub fn resume_branch<L: TransitionLogStore>(
&self,
log: L,
options: EngineOptions,
merge_base_record: &str,
) -> Result<Branch<T, P, L>, LinkError>
pub fn resume_branch<L: TransitionLogStore>( &self, log: L, options: EngineOptions, merge_base_record: &str, ) -> Result<Branch<T, P, L>, LinkError>
Restore a branch using a merge-base record saved by its previous owner. The caller must associate that descriptor with the same logical parent. A descriptor must identify a real committed revision of the branch log.
Source§impl<T: LinkReference, L: TransitionLogStore> Engine<T, L>
impl<T: LinkReference, L: TransitionLogStore> Engine<T, L>
Sourcepub fn export_checkpoint(&self) -> Result<Vec<String>, LinkError>
pub fn export_checkpoint(&self) -> Result<Vec<String>, LinkError>
Export retained committed snapshots without rewriting the live log. The caller owns atomic publication and synchronization of these records.
Sourcepub fn export_checkpoint_at(
&self,
revision: u64,
) -> Result<Vec<String>, LinkError>
pub fn export_checkpoint_at( &self, revision: u64, ) -> Result<Vec<String>, LinkError>
Export the retained snapshots up to one retained revision, as a journal whose reopened head is that revision.
Sourcepub fn backup_to<D: TransitionLogStore>(
&self,
destination: &mut D,
revision: Option<u64>,
) -> Result<u64, LinkError>
pub fn backup_to<D: TransitionLogStore>( &self, destination: &mut D, revision: Option<u64>, ) -> Result<u64, LinkError>
Copy a consistent cut to an empty log while commits continue, and return
the revision it ends at. None selects the current revision; a retained
earlier revision gives a point-in-time copy.
The commit mutex is held only while the cut is encoded, never during
destination I/O, so a slow or failing destination cannot delay or fence
this engine. After a failure the destination may hold a shorter copy, so
discard it. See docs/ENGINE-BACKUP.md.
Sourcepub fn backup_incremental_to<D: TransitionLogStore>(
&self,
destination: &mut D,
) -> Result<u64, LinkError>
pub fn backup_incremental_to<D: TransitionLogStore>( &self, destination: &mut D, ) -> Result<u64, LinkError>
Bring an earlier backup of this engine up to the current revision by appending only the revisions it lacks, each as the rows that changed, and return the revision it now ends at. An empty destination gets a full copy.
The destination’s last revision must still be retained here and hold the
same rows, otherwise it is refused and left alone: take a full backup. The
commit mutex is held only to select the snapshots. After a failure the
destination may end at an earlier revision, and calling again continues
from there. See docs/ENGINE-BACKUP.md.
Source§impl<T: LinkReference, L: ReplaceableTransitionLogStore> Engine<T, L>
impl<T: LinkReference, L: ReplaceableTransitionLogStore> Engine<T, L>
Sourcepub fn compact_journal(&self) -> Result<bool, LinkError>
pub fn compact_journal(&self) -> Result<bool, LinkError>
Atomically replace the journal while holding the commit mutex. Identical records return false. Any replacement error fences this owner until reopen. Unsupported capability leaves the engine available for ordinary commits.
Sourcepub fn compact_journal_after(&self, commits: u64) -> Result<bool, LinkError>
pub fn compact_journal_after(&self, commits: u64) -> Result<bool, LinkError>
Compact once at least commits revisions have landed since the last
compaction by this owner, and otherwise do nothing and return false. A log
that cannot be replaced is refused either way, so a wrong selection shows at
once. The first call after opening counts from revision 0, which also
compacts a journal left long by an earlier owner. See
docs/ENGINE-CHECKPOINTS.md.
Source§impl<T: LinkReference, L: TransitionLogStore> Engine<T, L>
impl<T: LinkReference, L: TransitionLogStore> Engine<T, L>
Sourcepub fn commit_group(
&self,
sessions: Vec<EngineTransaction<T, L>>,
) -> Result<Vec<GroupCommitOutcome>, LinkError>
pub fn commit_group( &self, sessions: Vec<EngineTransaction<T, L>>, ) -> Result<Vec<GroupCommitOutcome>, LinkError>
Consume independent sessions and share one flush across accepted writes.
Validation follows input order and retains the configured isolation rules.
Each write session retains its own revision; this is not an atomic batch.
An uncertain append/flush fences the engine and retains its old visible
state. All provisionally accepted members then return Indeterminate,
including read-only members that may depend on a tentative revision.
Foreign sessions cause an outer error before I/O; consumed sessions are rolled back on that path. A log that syncs on every append still performs those syncs; select buffered append with durable flush to amortize them. Private preparation retains history/map metadata and selected logical revision records until publication. Ordinary commits keep their own path.