pub struct SQLiteKeyValueStore { /* private fields */ }Expand description
A logical byte-store session sharing transaction state with its managed connection clones.
Implementations§
Source§impl SQLiteKeyValueStore
impl SQLiteKeyValueStore
pub fn open(path: &Path) -> SQLiteResult<Self>
pub fn open_in_memory() -> SQLiteResult<Self>
pub fn new(conn: ManagedConnection) -> SQLiteResult<Self>
Sourcepub fn with_options(
conn: ManagedConnection,
options: VersionedSessionOptions,
) -> SQLiteResult<Self>
pub fn with_options( conn: ManagedConnection, options: VersionedSessionOptions, ) -> SQLiteResult<Self>
Bind the connection and every existing clone to one bounded logical session.
pub fn connection(&self) -> ManagedConnection
pub fn new_session(&self) -> Self
pub fn new_session_with_cancellation( &self, cancellation: &CancellationToken, ) -> Self
pub fn pending_commit(&self) -> Option<StorageTransactionId>
Trait Implementations§
Source§impl Clone for SQLiteKeyValueStore
impl Clone for SQLiteKeyValueStore
Source§impl IdentifierAllocator for SQLiteKeyValueStore
impl IdentifierAllocator for SQLiteKeyValueStore
Source§fn identifier_watermark(
&self,
namespace: &[u8],
) -> StorageBackendResult<Option<u64>>
fn identifier_watermark( &self, namespace: &[u8], ) -> StorageBackendResult<Option<u64>>
Read the current autonomous watermark without reserving an identity or creating a namespace. This read is independent of the logical record snapshot and remains available to read-only sessions.
fn allocate_identifiers( &self, namespace: &[u8], request: IdentifierRequest, ) -> StorageBackendResult<IdentifierAllocation>
Source§impl KeyValueStore for SQLiteKeyValueStore
impl KeyValueStore for SQLiteKeyValueStore
Source§fn resource_leases(&self) -> Option<&dyn ResourceLeaseProvider>
fn resource_leases(&self) -> Option<&dyn ResourceLeaseProvider>
Physical resource ownership for retained builds and recovery. Versioned wrappers must forward this capability.
Source§fn auxiliary_encryption_key(&self) -> Option<StorageEncryptionKey>
fn auxiliary_encryption_key(&self) -> Option<StorageEncryptionKey>
Credential for database-owned auxiliary files. Wrappers over an encrypted store must forward it;
None permits unencrypted auxiliary storage.Source§fn retention_control(&self) -> Option<StorageReadControl>
fn retention_control(&self) -> Option<StorageReadControl>
Shared session allowance, including resources retained by readers after their producer finishes. Versioned wrappers must forward this capability.
Source§fn notification_publications(&self) -> Option<&dyn NotificationPublicationStore>
fn notification_publications(&self) -> Option<&dyn NotificationPublicationStore>
Atomic auxiliary notification publication and fresh committed recovery. Session wrappers must forward this capability.
Source§fn serializable_session(&self) -> Option<&dyn SerializableSession>
fn serializable_session(&self) -> Option<&dyn SerializableSession>
Original participant admission and logical observations. Wrappers must forward this capability, including original attribution on retained read-only sessions; capability presence does not establish complete SQL SSI support.
Source§fn vacuum(&self) -> StorageBackendResult<()>
fn vacuum(&self) -> StorageBackendResult<()>
Reclaim obsolete records and compact physical storage where supported, outside this session’s transaction.
Source§fn reclaim_obsolete(&self) -> StorageBackendResult<()>
fn reclaim_obsolete(&self) -> StorageBackendResult<()>
Reclaim obsolete records and committed history without a whole-file rewrite. Versioned wrappers must forward maintenance; serialized stores that eagerly remove obsolete values may keep the default.
Source§fn write_cancellation(&self) -> Option<CancellationToken>
fn write_cancellation(&self) -> Option<CancellationToken>
Token shared with the execution that owns this session’s writes. Cancellation must not prevent rollback cleanup or diagnostic reads. Versioned wrappers must forward this capability.
Source§fn open_session_with_cancellation(
&self,
cancellation: &CancellationToken,
) -> StorageBackendResult<Arc<dyn KeyValueStore>>
fn open_session_with_cancellation( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<Arc<dyn KeyValueStore>>
Create a transaction-isolated session with the caller’s write cancellation and a fresh retention budget.
Source§fn open_controlled_session(
&self,
control: &StorageReadControl,
) -> StorageBackendResult<Arc<dyn KeyValueStore>>
fn open_controlled_session( &self, control: &StorageReadControl, ) -> StorageBackendResult<Arc<dyn KeyValueStore>>
Open an independent writer sharing the invoking maintenance operation’s allowance and write cancellation. Retained reads and cleanup keep independent cancellation. Capable wrappers must forward this without granting another memory limit.
Source§fn open_retained_read_session(
&self,
cancellation: &CancellationToken,
) -> StorageBackendResult<Arc<dyn KeyValueStore>>
fn open_retained_read_session( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<Arc<dyn KeyValueStore>>
Retain this exact committed/private view in a separate read-only session, including its original logical reader attribution. The returned session cannot publish records or complete the source transaction. Versioned wrappers must forward this capability; opening a newer independent snapshot is not equivalent.
Source§fn transaction_model(&self) -> StorageTransactionModel
fn transaction_model(&self) -> StorageTransactionModel
Whether writes remain private while independent sessions read and write. Versioned stores must provide command refresh, retained reads, savepoint undo and conditional publication under one reported affinity.
Source§fn refresh_transaction_snapshot(
&self,
cancellation: &CancellationToken,
) -> StorageBackendResult<()>
fn refresh_transaction_snapshot( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<()>
Advance an active logical transaction’s committed view while preserving its private writes and retained readers. The caller chooses command boundaries allowed by SQL isolation. Stores without this capability must reject the request; ending or replaying the caller’s transaction is not a valid fallback.
Source§fn identifier_allocator(&self) -> Option<&dyn IdentifierAllocator>
fn identifier_allocator(&self) -> Option<&dyn IdentifierAllocator>
Durable reservations outside private record undo. Serialized custom stores may omit this capability; wrappers over a capable store must forward it.
Source§fn with_read_view(
&self,
read: &mut KeyValueReadScope<'_>,
) -> StorageBackendResult<()>
fn with_read_view( &self, read: &mut KeyValueReadScope<'_>, ) -> StorageBackendResult<()>
Evaluate a compound read once against one fixed committed/private view. The callback must use the supplied reader and must not reenter this session. Stores without this capability reject it explicitly.
Source§fn with_mutation(
&self,
mutate: &mut KeyValueMutation<'_>,
) -> StorageBackendResult<()>
fn with_mutation( &self, mutate: &mut KeyValueMutation<'_>, ) -> StorageBackendResult<()>
Evaluate once against the same view that supplies write preconditions, then atomically stage the batch. Errors and unwinds discard that batch; failed publication retains the evaluated attempt. The callback must not reenter this session or perform transaction control.
Source§fn with_versioned_mutation(
&self,
mutate: &mut KeyValueVersionedMutation<'_>,
) -> StorageBackendResult<()>
fn with_versioned_mutation( &self, mutate: &mut KeyValueVersionedMutation<'_>, ) -> StorageBackendResult<()>
Evaluate and stage once with the actual durable writer and a non-reused mutation revision. Origins may be persisted alongside canonical values, but do not prove publication or visibility. The callback has the same non-reentrancy rules as
with_mutation; capable wrappers must preserve the original origin and atomic batch.Source§fn transaction_affinity(&self) -> Option<StorageSessionAffinity>
fn transaction_affinity(&self) -> Option<StorageSessionAffinity>
Identity of the transaction context shared by this store’s catalog and data handles. Independent sessions must report different identities, even over the same file.
fn storage_identity( &self, ) -> StorageBackendResult<Option<PersistentStorageIdentity>>
Source§fn open_session(&self) -> StorageBackendResult<Arc<dyn KeyValueStore>>
fn open_session(&self) -> StorageBackendResult<Arc<dyn KeyValueStore>>
Open an independent transaction session over the same logical store. The default keeps simple test/custom stores source-compatible while making the missing MVCC capability explicit when a persistent engine needs a committed reader alongside a pinned statement snapshot.
fn get(&self, key: &[u8]) -> StorageBackendResult<Option<Vec<u8>>>
fn contains_key(&self, key: &[u8]) -> StorageBackendResult<bool>
Source§fn contains_prefix_budgeted(
&self,
prefix: &[u8],
control: &StorageReadControl,
) -> StorageBackendResult<bool>
fn contains_prefix_budgeted( &self, prefix: &[u8], control: &StorageReadControl, ) -> StorageBackendResult<bool>
Test prefix existence under the read allowance. Providers that materialize values should implement a key-only probe.
Source§fn visit_value(
&self,
key: &[u8],
control: &StorageReadControl,
visit: &mut ValueReadVisitor<'_>,
) -> StorageBackendResult<()>
fn visit_value( &self, key: &[u8], control: &StorageReadControl, visit: &mut ValueReadVisitor<'_>, ) -> StorageBackendResult<()>
Visit one borrowed value under the retained read. Providers reserve any temporary encoded payload before fetching it; callbacks must not reenter the store.
Source§fn visit_value_bounded(
&self,
key: &[u8],
max_bytes: usize,
control: &StorageReadControl,
visit: &mut ValueReadVisitor<'_>,
) -> StorageBackendResult<()>
fn visit_value_bounded( &self, key: &[u8], max_bytes: usize, control: &StorageReadControl, visit: &mut ValueReadVisitor<'_>, ) -> StorageBackendResult<()>
Visit one value with an encoded-size cap checked before provider materialization. This is distinct from the shared workspace allowance; unsupported stores must not fetch an unbounded value as a fallback.
Source§fn visit_prefix_after(
&self,
prefix: &[u8],
after: Option<&[u8]>,
limit: usize,
control: &StorageReadControl,
visit: &mut KeyValueReadVisitor<'_>,
) -> StorageBackendResult<()>
fn visit_prefix_after( &self, prefix: &[u8], after: Option<&[u8]>, limit: usize, control: &StorageReadControl, visit: &mut KeyValueReadVisitor<'_>, ) -> StorageBackendResult<()>
Visit at most
limit entries in key order, strictly after after when supplied. Encoded values remain borrowed from their provider owner and callbacks must not reenter the store.fn put(&self, key: &[u8], value: &[u8]) -> StorageBackendResult<()>
fn delete(&self, key: &[u8]) -> StorageBackendResult<()>
fn delete_prefix(&self, prefix: &[u8]) -> StorageBackendResult<usize>
fn scan_prefix( &self, prefix: &[u8], ) -> StorageBackendResult<Vec<(Vec<u8>, Vec<u8>)>>
Source§fn scan_prefix_after(
&self,
prefix: &[u8],
after: Option<&[u8]>,
limit: usize,
) -> StorageBackendResult<Vec<(Vec<u8>, Vec<u8>)>>
fn scan_prefix_after( &self, prefix: &[u8], after: Option<&[u8]>, limit: usize, ) -> StorageBackendResult<Vec<(Vec<u8>, Vec<u8>)>>
Return at most
limit key/value pairs in key order, strictly after
after when supplied. This is the bounded value cursor used by large
format migrations and other paged consumers.Source§fn scan_prefix_keys_after(
&self,
prefix: &[u8],
after: Option<&[u8]>,
limit: usize,
) -> StorageBackendResult<Vec<Vec<u8>>>
fn scan_prefix_keys_after( &self, prefix: &[u8], after: Option<&[u8]>, limit: usize, ) -> StorageBackendResult<Vec<Vec<u8>>>
Return at most
limit keys in key order, strictly after after when
it is present. Backends should override this method with a key-only,
bounded range scan so cursor consumers neither materialize the entire
prefix nor read values they do not need on every page.fn first_prefix_after( &self, prefix: &[u8], after: Option<&[u8]>, ) -> StorageBackendResult<Option<(Vec<u8>, Vec<u8>)>>
fn batch(&self) -> Box<dyn KeyValueBatch + '_>
fn begin_transaction(&self) -> StorageBackendResult<()>
fn begin_read_transaction(&self) -> StorageBackendResult<()>
fn begin_upgradeable_transaction(&self) -> StorageBackendResult<()>
fn in_transaction(&self) -> bool
Source§fn transaction_has_written(&self) -> StorageBackendResult<bool>
fn transaction_has_written(&self) -> StorageBackendResult<bool>
Report ordinary record and derived-index writes, excluding typed auxiliary notification effects. Ordinary writes remain forbidden in read-only transactions.
fn change_version(&self) -> StorageBackendResult<Option<u64>>
fn change_version_monitor_is_nonblocking(&self) -> StorageBackendResult<bool>
fn pin_transaction_snapshot(&self) -> StorageBackendResult<()>
fn commit_transaction(&self) -> StorageBackendResult<()>
fn rollback_transaction(&self) -> StorageBackendResult<()>
fn savepoint(&self, name: &str) -> StorageBackendResult<()>
fn release_savepoint(&self, name: &str) -> StorageBackendResult<()>
fn rollback_to_savepoint(&self, name: &str) -> StorageBackendResult<()>
Auto Trait Implementations§
impl !RefUnwindSafe for SQLiteKeyValueStore
impl !UnwindSafe for SQLiteKeyValueStore
impl Freeze for SQLiteKeyValueStore
impl Send for SQLiteKeyValueStore
impl Sync for SQLiteKeyValueStore
impl Unpin for SQLiteKeyValueStore
impl UnsafeUnpin for SQLiteKeyValueStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more