Skip to main content

SQLiteRecordStore

Struct SQLiteRecordStore 

Source
pub struct SQLiteRecordStore { /* private fields */ }
Expand description

Record persistence over a managed SQLite pool, including SQLCipher and compressed connections. Snapshots retain logical sequences; this adapter does not retain physical transactions between operations.

Logical snapshot leases protect predecessor histories across bounded reads and native processes; reclamation preserves head tombstones and all commit receipts. The Key/Value provider uses these records directly. Self::for_native converts a native catalog and atomically maintains its current rows with their history; ManagedConnection::bind_native_records binds catalog and data handles to the same logical session.

Implementations§

Source§

impl SQLiteRecordStore

Source

pub fn set_receipt_retention_limit( &self, limit: u64, control: &StorageReadControl, ) -> VersionResult<()>

Set the shared database’s maximum retained receipt count. Pending, unacknowledged and SSI-referenced receipts all count. Lowering the limit preserves existing entries and prevents allocation until release/reclamation makes room. The default is 65,536 entries; zero and values above SQLite’s positive i64 range are rejected.

Source§

impl SQLiteRecordStore

Source

pub fn admit_serializable<T>( &self, read_only: bool, control: &StorageReadControl, capture: impl FnOnce() -> VersionResult<T>, ) -> VersionResult<(SerializableParticipant, T)>

Reconcile abandoned participants, retain a new participant and capture its fixed data view under shared admission. The returned handle must outlive every operation and retained nested/pinned view attributed to it. All publishers must use the same shared admission; this does not by itself enable SQL SSI.

Source

pub fn recover_serializable( &self, control: &StorageReadControl, ) -> VersionResult<()>

Reconcile receipts and retire dead retained participants without admitting a new one. Untracked legacy actors remain manually owned. A missing prepared receipt is an error, not evidence of abort.

Source§

impl SQLiteRecordStore

Source

pub fn serializable_admission( &self, control: &StorageReadControl, ) -> VersionResult<SQLiteSerializableAdmission>

Acquire the shared SSI state without retaining a main-database physical transaction. The supplied allowance bounds the decoded graph and its predicate keys; serialization streams directly to a transactional BLOB.

Source§

impl SQLiteRecordStore

Source

pub fn new(connection: &ManagedConnection) -> VersionResult<Self>

Source

pub fn for_native( connection: &ManagedConnection, control: &StorageReadControl, ) -> VersionResult<Self>

Atomically initialize or upgrade a native catalog and import its baseline, or reopen its versioned materialization. Unbound native store handles are disabled after conversion; callers must bind a routed native session or prepare native records through the shared transaction contract.

Source

pub fn native_namespace(&self) -> Option<DatabaseId>

Immutable namespace for database-owned native record keys. Use it with NativeRecordOwner::Database; VersionedPersistence::database_id identifies the transaction history and may differ after restoration. Key/Value and raw record stores return None.

Trait Implementations§

Source§

impl Clone for SQLiteRecordStore

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl SerializableCoordinator for SQLiteRecordStore

Source§

fn with_serializable_admission( &self, control: &StorageReadControl, operation: &mut SerializableOperation<'_>, ) -> VersionResult<()>

Invoke the operation exactly once after loading retained state under exclusive SSI admission. Retain its graph mutations before releasing admission, including when the operation fails or cancels after confirming physical outcomes. Persistence failure takes precedence and never proves a main transaction aborted. Persist a prepared physical receipt binding in an earlier admission before publishing main records; reacquire admission for publication and outcome resolution. The operation may perform bounded main-record operations, but must not reenter SSI admission, wait for logical locks or execute application callbacks. Retain no main physical writer across the operation.
Source§

fn admit_serializable_snapshot( &self, read_only: bool, control: &StorageReadControl, ) -> Result<(SerializableParticipant, Arc<dyn CommittedRecordSnapshot>), VersionError>

Admit the original participant and its fixed committed snapshot at one shared boundary. Every nested or pinned view must retain this participant. This low-level capability requires all publishers to use the coordinated observation/publication protocol before SQL SSI can be enabled.
Source§

fn recover_serializable_participants( &self, control: &StorageReadControl, ) -> Result<(), VersionError>

Reconcile exact physical receipts and recover only participants whose lease owner is authoritatively gone. Unknown receipts block recovery rather than implying abort.
Source§

impl VersionedPersistence for SQLiteRecordStore

Source§

fn serializable_coordinator(&self) -> Option<&dyn SerializableCoordinator>

Shared participant admission and recovery for this exact physical database. Wrappers must forward the capability; its presence alone does not enable public SQL SSI.
Source§

fn identifier_watermark( &self, namespace: &[u8], control: &StorageReadControl, ) -> VersionResult<Option<u64>>

Read the latest autonomous watermark in one physical read transaction. Absence must remain absent; this must not acquire write admission, create records or change allocation state. Validate the database incarnation and retain the caller’s resource and cancellation controls.
Source§

fn allocate_identifiers( &self, namespace: &[u8], request: IdentifierRequest, control: &StorageReadControl, ) -> VersionResult<IdentifierAllocation>

Atomically observe or reserve identifiers under the database’s physical admission. Persist the high watermark before returning; an error may consume identifiers but must never permit their reuse. This operation advances neither record visibility nor transaction allocation, publishes no private records, and survives transaction/savepoint rollback. Implementations and wrappers must preserve the caller’s resource/cancellation control and reject a different database incarnation.
Source§

fn database_id(&self) -> DatabaseId

Source§

fn graph_record_layout(&self) -> Option<&dyn GraphRecordLayout>

Source§

fn occurrence_record_layout(&self) -> &dyn OccurrenceRecordLayout

Common Key/Value addressing is the default. Native record adapters and their wrappers must return their own physical occurrence layout.
Source§

fn notification_record_layout(&self) -> &dyn NotificationRecordLayout

Source§

fn maintenance_record_layout(&self) -> &dyn MaintenanceRecordLayout

Source§

fn ivf_record_layout(&self) -> &dyn IVFRecordLayout

Source§

fn hnsw_record_layout(&self) -> Option<&dyn HNSWRecordLayout>

Native adapters must override this when their physical node and edge families differ.
Source§

fn allocate_transaction( &self, control: &StorageReadControl, ) -> VersionResult<StorageTransactionId>

Persist a new transaction allocation before returning it, without advancing record visibility.
Source§

fn allocate_managed_transaction( &self, control: &StorageReadControl, ) -> VersionResult<RetainedTransactionAllocation>

Allocate a receipt with explicit managed resolution ownership. Publish its lease before the Pending row becomes durable under the same receipt admission used by recovery. Only an authoritatively absent managed lease permits abandoned-owner recovery; raw allocations retain manual ownership. The default preserves legacy indefinite receipt retention.
Source§

fn snapshot( &self, control: &StorageReadControl, ) -> VersionResult<Arc<dyn CommittedRecordSnapshot>>

Source§

fn reclaim_versions(&self, control: &StorageReadControl) -> VersionResult<u64>

Atomically remove obsolete historical revisions under snapshot admission. Preserve the newest revision at/before every live snapshot, all newer revisions, head tombstones and every transaction receipt. Neither visibility nor transaction allocation advances. Wrappers must forward the capability and its resource/cancellation control.
Source§

fn commit( &self, transaction: StorageTransactionId, prepared: &PreparedRecordCommit, control: &StorageReadControl, ) -> CommitResult

Retry the same sealed logical changes and fingerprint. Return a durable matching receipt before validating snapshots or record heads. After verifying a pending receipt under exclusive admission, call PreparedRecordCommit::validate_snapshot before validating heads; only its rejection permits common storage to materialize derived effects again. Canonical changes and application callbacks must never be replayed, and mismatched fingerprint reuse is rejected.
Source§

fn commit_status( &self, transaction: StorageTransactionId, control: &StorageReadControl, ) -> VersionResult<CommitStatus>

Source§

fn acknowledge_transaction( &self, acknowledgement: ReceiptAcknowledgement, control: &StorageReadControl, ) -> VersionResult<()>

Durably release caller resolution ownership only after preserving its confirmed terminal outcome. This never releases a retained SSI publication. The default keeps historical receipts indefinitely; providers with bounded receipts override it. Errors preserve the caller’s completed retry state, and a retry after durable acknowledgement remains valid even after reclamation.
Source§

fn reclaim_transaction_receipts( &self, control: &StorageReadControl, ) -> VersionResult<u64>

Reclaim explicitly acknowledged receipts only after their final durable SSI publication reference has disappeared. Pending and unacknowledged receipts survive, including unknown completion owners. This is separate from record-history reclamation and does not advance allocation or visibility.
Source§

fn abort( &self, transaction: StorageTransactionId, control: &StorageReadControl, ) -> VersionResult<CommitStatus>

Atomically end a pending allocation. Return an existing committed receipt unchanged; abort must never overwrite a commit.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.