pub struct SqliteStore { /* private fields */ }Expand description
A synchronous local database with validated snapshots and immutable operation history.
Implementations§
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn history_blocking(
&self,
after_sequence: u64,
limit: u16,
) -> Result<HistoryPage, StoreError>
pub fn history_blocking( &self, after_sequence: u64, limit: u16, ) -> Result<HistoryPage, StoreError>
Read at most 1000 operations after a local sequence cursor without modifying history.
Sourcepub fn recorded_operation_blocking(
&self,
id: OperationId,
) -> Result<Option<HistoryEntry>, StoreError>
pub fn recorded_operation_blocking( &self, id: OperationId, ) -> Result<Option<HistoryEntry>, StoreError>
The operation recorded under this identity, if any, whichever lineage recorded it.
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn backup_blocking(&self, to: &Path) -> Result<IntegrityReport, StoreError>
pub fn backup_blocking(&self, to: &Path) -> Result<IntegrityReport, StoreError>
Copy the committed snapshot, full operation history and schema version into a new file, then verify the copy; an existing file is never overwritten.
When the store has a run store beside it, that is copied too, to <backup>.runs, and the
report says so; the project backup file alone never contains runs.
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn open_blocking(path: impl AsRef<Path>) -> Result<Self, StoreError>
pub fn open_blocking(path: impl AsRef<Path>) -> Result<Self, StoreError>
Create or open a database without writing to it; Self::initialize_blocking creates the
schema.
Sourcepub fn open_existing_blocking(
path: impl AsRef<Path>,
) -> Result<Self, StoreError>
pub fn open_existing_blocking( path: impl AsRef<Path>, ) -> Result<Self, StoreError>
Open an existing database without creating a new file or writing to it; a store in a retired or newer layout is refused unchanged.
Sourcepub fn in_memory_blocking() -> Result<Self, StoreError>
pub fn in_memory_blocking() -> Result<Self, StoreError>
Create an isolated in-memory database for ephemeral work and tests.
Sourcepub fn set_busy_timeout_blocking(
&self,
timeout: Duration,
) -> Result<(), StoreError>
pub fn set_busy_timeout_blocking( &self, timeout: Duration, ) -> Result<(), StoreError>
Wait at most timeout for another connection’s lock before failing as busy.
Sourcepub fn lineage_blocking(&self) -> Result<Option<StoreLineage>, StoreError>
pub fn lineage_blocking(&self) -> Result<Option<StoreLineage>, StoreError>
The lineage this file continues, if initialized.
Sourcepub fn revision_blocking(&self) -> Result<Option<StoreRevision>, StoreError>
pub fn revision_blocking(&self) -> Result<Option<StoreRevision>, StoreError>
The committed revision and its lineage, read in one transaction without the snapshot text,
so polling for changes costs two row reads; None for an uninitialized store.
Sourcepub fn plan_before_blocking(&self, sequence: u64) -> Result<Plan, StoreError>
pub fn plan_before_blocking(&self, sequence: u64) -> Result<Plan, StoreError>
The plan as it stood before the operation at local sequence sequence, replayed from the
genesis plan; a resent plan change is compared against the state it was first applied to.
Sourcepub fn load_blocking(&self) -> Result<Option<Plan>, StoreError>
pub fn load_blocking(&self) -> Result<Option<Plan>, StoreError>
Read and validate the authoritative snapshot, if initialized.
Sourcepub fn initialize_blocking(&mut self, plan: &Plan) -> Result<(), StoreError>
pub fn initialize_blocking(&mut self, plan: &Plan) -> Result<(), StoreError>
Initialize an empty database with plan as both the snapshot and the genesis plan the
history replays from; an existing snapshot or operation history is never erased, and a
refused initialization writes nothing.
Sourcepub fn persist_blocking(
&mut self,
plan: &Plan,
operation: &Operation,
expected_lineage: Option<LineageId>,
) -> Result<HistoryEntry, StoreError>
pub fn persist_blocking( &mut self, plan: &Plan, operation: &Operation, expected_lineage: Option<LineageId>, ) -> Result<HistoryEntry, StoreError>
Atomically append one valid operation and the exact snapshot produced by that command, under this file’s lineage.
Inside the write transaction, an identity that is already recorded is answered with
StoreError::DuplicateOperation before any precondition, an archive is refused, and so
is a lineage other than expected_lineage or a revision other than the operation’s base.
Sourcepub fn operation_count_blocking(&self) -> Result<u64, StoreError>
pub fn operation_count_blocking(&self) -> Result<u64, StoreError>
Count committed semantic operations.