pub struct VersionedKeyValueStore { /* private fields */ }Expand description
A provider-independent session with pinned reads and conditional atomic publication. Common storage resolves typed index changes before physical admission; SQL isolation and tuple locks remain above this byte-record contract.
Implementations§
Source§impl VersionedKeyValueStore
impl VersionedKeyValueStore
Sourcepub fn with_versioned_record_mutation<T>(
&self,
operation: impl FnOnce(StorageMutationOrigin, MergedRecordSnapshot, &mut dyn KeyValueBatch) -> StorageBackendResult<T>,
) -> StorageBackendResult<T>
pub fn with_versioned_record_mutation<T>( &self, operation: impl FnOnce(StorageMutationOrigin, MergedRecordSnapshot, &mut dyn KeyValueBatch) -> StorageBackendResult<T>, ) -> StorageBackendResult<T>
Evaluate one provider mutation against the same fixed native record view as its batch. The callback must not reenter this session or complete its batch. Common MVCC owns autocommit, failed-evaluation cleanup and receipt retry; callbacks are never replayed.
Sourcepub fn reclaim_versions(&self) -> StorageBackendResult<u64>
pub fn reclaim_versions(&self) -> StorageBackendResult<u64>
Reclaim committed history without changing an active transaction or its retained readers. The persistence owner supplies atomic snapshot admission and physical deletion.
Sourcepub fn identifier_watermark(
&self,
namespace: &[u8],
) -> StorageBackendResult<Option<u64>>
pub fn identifier_watermark( &self, namespace: &[u8], ) -> StorageBackendResult<Option<u64>>
Autonomous watermark visibility follows physical reservations, including reservations made after this session pinned its record snapshot. No write capability is required and no logical transaction is started or finished.
Sourcepub fn allocate_identifiers(
&self,
namespace: &[u8],
request: IdentifierRequest,
) -> StorageBackendResult<IdentifierAllocation>
pub fn allocate_identifiers( &self, namespace: &[u8], request: IdentifierRequest, ) -> StorageBackendResult<IdentifierAllocation>
Reserve identities without publishing this session’s private records. Read-only sessions and unresolved sealed commits cannot allocate; rollback never reclaims a successful reservation.
pub fn new( persistence: Arc<dyn VersionedPersistence>, identity: Option<PersistentStorageIdentity>, options: VersionedSessionOptions, ) -> Self
Sourcepub fn new_with_cancellation(
persistence: Arc<dyn VersionedPersistence>,
identity: Option<PersistentStorageIdentity>,
options: VersionedSessionOptions,
write_cancellation: CancellationToken,
) -> Self
pub fn new_with_cancellation( persistence: Arc<dyn VersionedPersistence>, identity: Option<PersistentStorageIdentity>, options: VersionedSessionOptions, write_cancellation: CancellationToken, ) -> Self
Share the invoking execution’s cancellation during autonomous allocation and publication. Retained reads and rollback cleanup keep their independent control, so cancelling a statement cannot prevent its undo.
Sourcepub fn new_session(&self) -> Self
pub fn new_session(&self) -> Self
Create an independent logical session with the same persistence and retention limit.
Sourcepub fn new_session_with_cancellation(
&self,
cancellation: &CancellationToken,
) -> Self
pub fn new_session_with_cancellation( &self, cancellation: &CancellationToken, ) -> Self
Keep a separate transaction context and retention budget while inheriting the invoking writer’s cancellation.
Sourcepub fn new_controlled_session(&self, control: &StorageReadControl) -> Self
pub fn new_controlled_session(&self, control: &StorageReadControl) -> Self
Keep an independent writer while sharing the invoking operation’s memory allowance. Read/rollback cancellation stays independent so cleanup remains possible after write cancellation.
Sourcepub fn new_retained_read_session(
&self,
cancellation: &CancellationToken,
) -> StorageBackendResult<Self>
pub fn new_retained_read_session( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<Self>
Open an independently owned read-only session at this exact committed/private view. Its original participant, snapshot leases and retention allowance remain shared, while read cancellation stays independent. Completing this reader never completes the originating transaction.
pub fn options(&self) -> VersionedSessionOptions
Sourcepub fn record_snapshot(&self) -> VersionResult<MergedRecordSnapshot>
pub fn record_snapshot(&self) -> VersionResult<MergedRecordSnapshot>
Retain the current committed and private boundaries for a compound provider read. Later session mutations, rollback and commit do not advance this view.
Sourcepub fn refresh_transaction_snapshot(
&self,
cancellation: &CancellationToken,
) -> StorageBackendResult<()>
pub fn refresh_transaction_snapshot( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<()>
Advance an active transaction to the current committed boundary while retaining and rebasing its evaluated private changes. Retained readers keep their previous boundary; savepoint undo restores its matching private changes and committed base. SQL chooses when its isolation level allows this transition. A sealed commit cannot advance, and failed preparation leaves the active view unchanged.
Sourcepub fn retention_control(&self) -> StorageReadControl
pub fn retention_control(&self) -> StorageReadControl
Share this session’s retention allowance with provider codecs and retained record readers. Creating a control clone does not create another allowance.
pub fn session_affinity(&self) -> StorageSessionAffinity
Sourcepub fn pending_commit(&self) -> Option<StorageTransactionId>
pub fn pending_commit(&self) -> Option<StorageTransactionId>
Identify a sealed attempt after a failed commit. Retrying commit_transaction resubmits only the identical evaluated batch, and never reevaluates application code.
Sourcepub fn pending_transaction_completion(&self) -> Option<TransactionOutcomeId>
pub fn pending_transaction_completion(&self) -> Option<TransactionOutcomeId>
Identify a retained physical attempt or uncertain logical completion, including an empty/read-only SSI transaction without a write receipt. Completion retries never replay evaluated application work.
Sourcepub fn establish_serializable_snapshot(
&self,
) -> StorageBackendResult<SerializableReadContext>
pub fn establish_serializable_snapshot( &self, ) -> StorageBackendResult<SerializableReadContext>
Establish the original SSI participant and fixed record boundary before this transaction’s first logical access. SQL must call this at its first snapshot-bearing statement, then supply logical observations for every participating access path. Capability presence alone does not enable SQL SSI or fence legacy publishers.
Sourcepub fn observe_serializable_write(
&self,
predicate: SerializablePredicate<'_>,
) -> StorageBackendResult<()>
pub fn observe_serializable_write( &self, predicate: SerializablePredicate<'_>, ) -> StorageBackendResult<()>
Register a logical write before staging its records. SQL statement/savepoint ownership must encompass both this observation and the evaluated mutation. Retained record readers expose only read observation capability.
Trait Implementations§
Source§impl IdentifierAllocator for VersionedKeyValueStore
impl IdentifierAllocator for VersionedKeyValueStore
Source§fn identifier_watermark(
&self,
namespace: &[u8],
) -> StorageBackendResult<Option<u64>>
fn identifier_watermark( &self, namespace: &[u8], ) -> StorageBackendResult<Option<u64>>
fn allocate_identifiers( &self, namespace: &[u8], request: IdentifierRequest, ) -> StorageBackendResult<IdentifierAllocation>
Source§impl KeyValueStore for VersionedKeyValueStore
impl KeyValueStore for VersionedKeyValueStore
Source§fn resource_leases(&self) -> Option<&dyn ResourceLeaseProvider>
fn resource_leases(&self) -> Option<&dyn ResourceLeaseProvider>
Source§fn retention_control(&self) -> Option<StorageReadControl>
fn retention_control(&self) -> Option<StorageReadControl>
Source§fn notification_publications(&self) -> Option<&dyn NotificationPublicationStore>
fn notification_publications(&self) -> Option<&dyn NotificationPublicationStore>
Source§fn serializable_session(&self) -> Option<&dyn SerializableSession>
fn serializable_session(&self) -> Option<&dyn SerializableSession>
Source§fn reclaim_obsolete(&self) -> StorageBackendResult<()>
fn reclaim_obsolete(&self) -> StorageBackendResult<()>
Source§fn write_cancellation(&self) -> Option<CancellationToken>
fn write_cancellation(&self) -> Option<CancellationToken>
Source§fn open_controlled_session(
&self,
control: &StorageReadControl,
) -> StorageBackendResult<Arc<dyn KeyValueStore>>
fn open_controlled_session( &self, control: &StorageReadControl, ) -> StorageBackendResult<Arc<dyn KeyValueStore>>
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>>
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>>
Source§fn transaction_model(&self) -> StorageTransactionModel
fn transaction_model(&self) -> StorageTransactionModel
Source§fn refresh_transaction_snapshot(
&self,
cancellation: &CancellationToken,
) -> StorageBackendResult<()>
fn refresh_transaction_snapshot( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<()>
Source§fn identifier_allocator(&self) -> Option<&dyn IdentifierAllocator>
fn identifier_allocator(&self) -> Option<&dyn IdentifierAllocator>
Source§fn with_read_view(
&self,
operation: &mut KeyValueReadScope<'_>,
) -> StorageBackendResult<()>
fn with_read_view( &self, operation: &mut KeyValueReadScope<'_>, ) -> StorageBackendResult<()>
Source§fn with_mutation(
&self,
operation: &mut KeyValueMutation<'_>,
) -> StorageBackendResult<()>
fn with_mutation( &self, operation: &mut KeyValueMutation<'_>, ) -> StorageBackendResult<()>
Source§fn with_versioned_mutation(
&self,
operation: &mut KeyValueVersionedMutation<'_>,
) -> StorageBackendResult<()>
fn with_versioned_mutation( &self, operation: &mut KeyValueVersionedMutation<'_>, ) -> StorageBackendResult<()>
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>
fn storage_identity( &self, ) -> StorageBackendResult<Option<PersistentStorageIdentity>>
Source§fn open_session(&self) -> StorageBackendResult<Arc<dyn KeyValueStore>>
fn open_session(&self) -> StorageBackendResult<Arc<dyn KeyValueStore>>
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>
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<()>
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<()>
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<()>
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 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>)>>
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>>>
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 delete_prefix(&self, prefix: &[u8]) -> StorageBackendResult<usize>
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>
fn change_version(&self) -> StorageBackendResult<Option<u64>>
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<()>
Source§fn auxiliary_encryption_key(&self) -> Option<StorageEncryptionKey>
fn auxiliary_encryption_key(&self) -> Option<StorageEncryptionKey>
None permits unencrypted auxiliary storage.