Skip to main content

PersistentStorageBackend

Trait PersistentStorageBackend 

Source
pub trait PersistentStorageBackend: Send + Sync {
Show 55 methods // Required methods fn document_store(&self, table: &str) -> Box<dyn DocumentStore>; fn inverted_index( &self, table: &str, analyzer: Analyzer, ) -> Box<dyn InvertedIndex>; fn vector_index( &self, table: &str, field: &str, dimensions: u32, spec: VectorIndexSpec, mode: VectorIndexOpenMode, ) -> StorageBackendResult<Box<dyn VectorIndex>>; fn begin_transaction(&self) -> StorageBackendResult<()>; fn in_transaction(&self) -> bool; fn transaction_has_written(&self) -> StorageBackendResult<bool>; fn commit_transaction(&self) -> StorageBackendResult<()>; fn rollback_transaction(&self) -> StorageBackendResult<()>; fn savepoint(&self, id: StorageSavepointId) -> StorageBackendResult<()>; fn release_savepoint( &self, id: StorageSavepointId, ) -> StorageBackendResult<()>; fn rollback_to_savepoint( &self, id: StorageSavepointId, ) -> StorageBackendResult<()>; // Provided methods fn retention_control(&self) -> Option<StorageReadControl> { ... } fn notification_publications( &self, ) -> Option<&dyn NotificationPublicationStore> { ... } fn serializable_session(&self) -> Option<&dyn SerializableSession> { ... } fn write_cancellation(&self) -> Option<CancellationToken> { ... } fn open_session_with_cancellation( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<PersistentStorageSession> { ... } fn open_controlled_session( &self, _control: &StorageReadControl, ) -> StorageBackendResult<PersistentStorageSession> { ... } fn open_retained_read_session( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<PersistentStorageSession> { ... } fn transaction_model(&self) -> StorageTransactionModel { ... } fn identifier_allocator(&self) -> Option<&dyn IdentifierAllocator> { ... } fn transaction_affinity(&self) -> Option<StorageSessionAffinity> { ... } fn storage_identity( &self, ) -> StorageBackendResult<Option<PersistentStorageIdentity>> { ... } fn auxiliary_encryption_key(&self) -> Option<StorageEncryptionKey> { ... } fn open_session(&self) -> StorageBackendResult<PersistentStorageSession> { ... } fn supports_concurrent_pinned_read_and_write(&self) -> bool { ... } fn migrate_document_storage(&self) -> StorageBackendResult<()> { ... } fn migrate_inverted_index_storage(&self) -> StorageBackendResult<()> { ... } fn diskann_index( &self, _binding: DiskANNIndexBinding<'_>, _options: DiskANNIndexOptions, _temporary: &DiskANNTemporaryBudget, _mode: VectorIndexOpenMode, ) -> StorageBackendResult<Box<dyn VectorIndex>> { ... } fn diskann_journal_pruner( &self, _binding: DiskANNIndexBinding<'_>, _max_record_bytes: usize, ) -> StorageBackendResult<Box<dyn DiskANNJournalPruner>> { ... } fn diskann_maintenance_source( &self, _binding: DiskANNIndexBinding<'_>, _max_record_bytes: usize, ) -> StorageBackendResult<Box<dyn DiskANNMaintenanceSource>> { ... } fn retire_diskann_index( &self, _binding: DiskANNIndexBinding<'_>, ) -> StorageBackendResult<()> { ... } fn drop_vector_index_metadata( &self, _table: &str, _field: &str, ) -> StorageBackendResult<()> { ... } fn persists_btree_indexes(&self) -> bool { ... } fn load_btree_index( &self, _table: &str, _field: &ValueIndexKey, ) -> StorageBackendResult<Option<Vec<(DocId, Value)>>> { ... } fn btree_index_fields( &self, _table: &str, ) -> StorageBackendResult<Vec<ValueIndexKey>> { ... } fn read_btree_index_entry( &self, _table: &str, _field: &ValueIndexKey, _doc_id: DocId, ) -> StorageBackendResult<ValueIndexEntry> { ... } fn btree_index_repairs( &self, ) -> StorageBackendResult<Vec<(String, ValueIndexKey)>> { ... } fn clear_btree_index_repair( &self, _table: &str, _field: &ValueIndexKey, ) -> StorageBackendResult<()> { ... } fn replace_btree_index( &self, _table: &str, _field: &ValueIndexKey, _values: &[(DocId, Value)], ) -> StorageBackendResult<()> { ... } fn repair_btree_index( &self, table: &str, field: &ValueIndexKey, complete: &[(DocId, Value)], _stale_doc_ids: &[DocId], _missing: &[(DocId, Value)], ) -> StorageBackendResult<()> { ... } fn replace_btree_indexes( &self, table: &str, indexes: &[(&ValueIndexKey, &[(DocId, Value)])], ) -> StorageBackendResult<()> { ... } fn apply_btree_index_write( &self, _table: &str, _doc_id: DocId, _values: Option<&BTreeMap<ValueIndexKey, Value>>, ) -> StorageBackendResult<()> { ... } fn apply_unused_btree_index_write( &self, table: &str, doc_id: DocId, values: &BTreeMap<ValueIndexKey, Value>, namespace: DocumentIdNamespace, ) -> StorageBackendResult<()> { ... } fn drop_btree_index( &self, _table: &str, _field: &ValueIndexKey, ) -> StorageBackendResult<()> { ... } fn clear_btree_indexes(&self, _table: &str) -> StorageBackendResult<()> { ... } fn reclaim_obsolete(&self) -> StorageBackendResult<()> { ... } fn vacuum(&self) -> StorageBackendResult<()> { ... } fn begin_read_transaction(&self) -> StorageBackendResult<()> { ... } fn begin_upgradeable_transaction(&self) -> StorageBackendResult<()> { ... } fn refresh_transaction_snapshot( &self, _cancellation: &CancellationToken, ) -> StorageBackendResult<()> { ... } fn change_version(&self) -> StorageBackendResult<Option<u64>> { ... } fn read_view_revision( &self, ) -> StorageBackendResult<Option<KeyValueReadRevision>> { ... } fn commit_monitor_version(&self) -> StorageBackendResult<Option<u64>> { ... } fn change_version_monitor_is_nonblocking( &self, ) -> StorageBackendResult<bool> { ... } fn pin_transaction_snapshot(&self) -> StorageBackendResult<()> { ... }
}
Expand description

Factory plus transaction surface for persistent table/index storage.

Required Methods§

Source

fn document_store(&self, table: &str) -> Box<dyn DocumentStore>

Source

fn inverted_index( &self, table: &str, analyzer: Analyzer, ) -> Box<dyn InvertedIndex>

Source

fn vector_index( &self, table: &str, field: &str, dimensions: u32, spec: VectorIndexSpec, mode: VectorIndexOpenMode, ) -> StorageBackendResult<Box<dyn VectorIndex>>

Source

fn begin_transaction(&self) -> StorageBackendResult<()>

Source

fn in_transaction(&self) -> bool

Whether this session currently owns a pinned storage transaction.

Source

fn transaction_has_written(&self) -> StorageBackendResult<bool>

Whether the current transaction changed user data, catalog or index state. Engine uses this to enforce read-only statement transactions, including unclassified helper writes. Typed auxiliary notification publication is excluded and never grants ordinary write access.

Source

fn commit_transaction(&self) -> StorageBackendResult<()>

Source

fn rollback_transaction(&self) -> StorageBackendResult<()>

Source

fn savepoint(&self, id: StorageSavepointId) -> StorageBackendResult<()>

Source

fn release_savepoint(&self, id: StorageSavepointId) -> StorageBackendResult<()>

Source

fn rollback_to_savepoint( &self, id: StorageSavepointId, ) -> StorageBackendResult<()>

Provided Methods§

Source

fn retention_control(&self) -> Option<StorageReadControl>

Shared allowance for this session’s private state and retained query resources. Versioned wrappers must forward it; nested retained readers keep the original allowance rather than granting another limit.

Source

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>

Original participant admission and logical observations, shared with the paired catalog transaction. Retained readers preserve original attribution without owning completion. Wrappers must forward this capability; SQL access-path coverage remains the execution owner’s responsibility.

Source

fn write_cancellation(&self) -> Option<CancellationToken>

Cancellation for this session’s physical write admission and publication. Retained reads and rollback cleanup must remain usable after cancellation. Versioned wrappers must forward the underlying token.

Source

fn open_session_with_cancellation( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<PersistentStorageSession>

Create an independent transaction context whose writes share the invoking execution’s cancellation. Versioned providers must implement this without rebinding another session’s token.

Source

fn open_controlled_session( &self, _control: &StorageReadControl, ) -> StorageBackendResult<PersistentStorageSession>

Admit a maintenance writer to the invoking operation’s existing allowance and write cancellation, while retaining independent transaction completion and cleanup. Capable wrappers must forward this rather than allocate another retention limit.

Source

fn open_retained_read_session( &self, cancellation: &CancellationToken, ) -> StorageBackendResult<PersistentStorageSession>

Bind an independent read-only catalog/backend pair to this exact committed/private view before restoration. Both handles must retain the original snapshot and logical reader attribution without taking ownership of transaction completion. Versioned wrappers must forward this capability.

Source

fn transaction_model(&self) -> StorageTransactionModel

Transaction ownership shared with the paired catalog. Legacy providers retain serialized Engine writer admission; versioned providers keep private writes and support command refresh without ending the transaction.

Source

fn identifier_allocator(&self) -> Option<&dyn IdentifierAllocator>

Durable identifier allocation independent of logical transaction undo. A missing capability retains serialized allocation; it cannot establish support for concurrent writers. Wrappers must forward the underlying capability.

Source

fn transaction_affinity(&self) -> Option<StorageSessionAffinity>

Identity shared with the paired catalog’s transaction context. Wrappers must delegate this when their underlying backend reports an identity.

Source

fn storage_identity( &self, ) -> StorageBackendResult<Option<PersistentStorageIdentity>>

Return the stable database identity for independently constructed engines over this backend. File identities also enable cross-process row-lock coordination.

Source

fn auxiliary_encryption_key(&self) -> Option<StorageEncryptionKey>

Return the encryption credential for database-owned auxiliary files, including engines constructed directly from this backend.

Source

fn open_session(&self) -> StorageBackendResult<PersistentStorageSession>

Open a transaction-isolated catalog/backend pair over the same durable database. Engines constructed from already-open backends retain this factory so a row-lock recheck can read the latest committed tuple while the caller’s statement snapshot remains pinned.

Source

fn supports_concurrent_pinned_read_and_write(&self) -> bool

Whether an independently pinned read session can remain open while another session writes the same database. Backends that return false use a detached fixed snapshot for REPEATABLE READ and SERIALIZABLE transactions.

Source

fn migrate_document_storage(&self) -> StorageBackendResult<()>

Upgrade backend-owned document records before table handles are restored. Implementations must make the rewrite atomic and idempotent.

Source

fn migrate_inverted_index_storage(&self) -> StorageBackendResult<()>

Upgrade backend-owned inverted-index values before table handles are restored. Implementations must make the rewrite atomic and idempotent.

Source

fn diskann_index( &self, _binding: DiskANNIndexBinding<'_>, _options: DiskANNIndexOptions, _temporary: &DiskANNTemporaryBudget, _mode: VectorIndexOpenMode, ) -> StorageBackendResult<Box<dyn VectorIndex>>

Open a catalog-bound DiskANN owner on this exact backend session. Creation joins the active catalog transaction and returns an initialized index; restoration never builds missing state.

Source

fn diskann_journal_pruner( &self, _binding: DiskANNIndexBinding<'_>, _max_record_bytes: usize, ) -> StorageBackendResult<Box<dyn DiskANNJournalPruner>>

Capture a finite change-journal pass without loading graph or resident PQ data. The returned handle uses this exact session’s active transactions and preserves its original catalog, coverage and resource controls; wrappers supporting DiskANN maintenance must forward it.

Source

fn diskann_maintenance_source( &self, _binding: DiskANNIndexBinding<'_>, _max_record_bytes: usize, ) -> StorageBackendResult<Box<dyn DiskANNMaintenanceSource>>

Retain one actual committed canonical/catalog view for exact change accounting, pruning and one evaluated rebuild. Construction never completes this session’s enclosing transaction or reloads the old resident graph.

Source

fn retire_diskann_index( &self, _binding: DiskANNIndexBinding<'_>, ) -> StorageBackendResult<()>

Source

fn drop_vector_index_metadata( &self, _table: &str, _field: &str, ) -> StorageBackendResult<()>

Source

fn persists_btree_indexes(&self) -> bool

Whether this backend maps logical btree indexes to durable postings.

Source

fn load_btree_index( &self, _table: &str, _field: &ValueIndexKey, ) -> StorageBackendResult<Option<Vec<(DocId, Value)>>>

Some(entries) is a complete persisted index; None means it has not been built yet and the engine must backfill it from documents once.

Source

fn btree_index_fields( &self, _table: &str, ) -> StorageBackendResult<Vec<ValueIndexKey>>

Source

fn read_btree_index_entry( &self, _table: &str, _field: &ValueIndexKey, _doc_id: DocId, ) -> StorageBackendResult<ValueIndexEntry>

Read one previously evaluated key on the caller’s retained transaction boundary, without loading the posting collection. An unbuilt index is distinct from an absent row and a stored NULL.

Source

fn btree_index_repairs( &self, ) -> StorageBackendResult<Vec<(String, ValueIndexKey)>>

Fields whose persisted posting support was found inconsistent during a schema migration. The engine repairs these at its explicit open-time write boundary and clears each durable retry marker only after success.

Source

fn clear_btree_index_repair( &self, _table: &str, _field: &ValueIndexKey, ) -> StorageBackendResult<()>

Source

fn replace_btree_index( &self, _table: &str, _field: &ValueIndexKey, _values: &[(DocId, Value)], ) -> StorageBackendResult<()>

Source

fn repair_btree_index( &self, table: &str, field: &ValueIndexKey, complete: &[(DocId, Value)], _stale_doc_ids: &[DocId], _missing: &[(DocId, Value)], ) -> StorageBackendResult<()>

Repair sparse support differences without requiring capable backends to rewrite every already-valid posting. The complete replacement is supplied for the storage-neutral fallback.

Source

fn replace_btree_indexes( &self, table: &str, indexes: &[(&ValueIndexKey, &[(DocId, Value)])], ) -> StorageBackendResult<()>

Replace several complete indexes for one table atomically. Backends may override this to share one transaction and prepared statements.

Source

fn apply_btree_index_write( &self, _table: &str, _doc_id: DocId, _values: Option<&BTreeMap<ValueIndexKey, Value>>, ) -> StorageBackendResult<()>

Source

fn apply_unused_btree_index_write( &self, table: &str, doc_id: DocId, values: &BTreeMap<ValueIndexKey, Value>, namespace: DocumentIdNamespace, ) -> StorageBackendResult<()>

Write the index entries of a document whose identity no document of the table ever had, as the caller has established from the identity watermark of namespace. A provider that keys its entries by that namespace may write them without reading what they would replace; the default writes them as any other document’s.

Source

fn drop_btree_index( &self, _table: &str, _field: &ValueIndexKey, ) -> StorageBackendResult<()>

Source

fn clear_btree_indexes(&self, _table: &str) -> StorageBackendResult<()>

Source

fn reclaim_obsolete(&self) -> StorageBackendResult<()>

Reclaim obsolete logical records and history outside a transaction without rewriting the whole physical database. Versioned providers must implement this capability; stores that eagerly remove obsolete values may keep the default.

Source

fn vacuum(&self) -> StorageBackendResult<()>

Reclaim backend-owned storage and compact the physical database outside a transaction. Backends whose logical stores eagerly remove obsolete values may keep the no-op default; durable backends with file-level compaction should override it.

Source

fn begin_read_transaction(&self) -> StorageBackendResult<()>

Begin a transaction whose first operation is expected to be a read. Backends with distinct lock modes may defer write-lock acquisition; the default preserves existing transaction semantics.

Source

fn begin_upgradeable_transaction(&self) -> StorageBackendResult<()>

Begin an atomic transaction that may remain read-only or perform writes after its initial reads. Backends without read-to-write promotion acquire a writer transaction immediately.

Source

fn refresh_transaction_snapshot( &self, _cancellation: &CancellationToken, ) -> StorageBackendResult<()>

Advance command visibility without ending the active logical transaction or replaying its writes. SQL isolation controls when this is permitted. Providers without logical snapshot refresh reject the request.

Source

fn change_version(&self) -> StorageBackendResult<Option<u64>>

Backend commit generation visible to this session, when available. A changing value invalidates session-local catalog and index caches.

Source

fn read_view_revision( &self, ) -> StorageBackendResult<Option<KeyValueReadRevision>>

Exact identity of the current committed and private record view for cache reuse. Equal identities guarantee equal record visibility, including after savepoint undo; providers without this capability return None. This process-local token must never be persisted or substituted for SQL isolation or serializable observations.

Source

fn commit_monitor_version(&self) -> StorageBackendResult<Option<u64>>

A value that changes whenever any session or process commits to this database, read without a transaction of this session. Two equal values prove that no commit lies between the two reads, so whatever was read from the committed state in between still is that state. None when the backend has no such monitor; a caller then reads the committed state again.

Source

fn change_version_monitor_is_nonblocking(&self) -> StorageBackendResult<bool>

Whether reading Self::change_version can proceed while this session owns its pinned transaction. An independent monitor can also be unsafe for a reader when a pending writer is waiting for that reader’s lock.

Source

fn pin_transaction_snapshot(&self) -> StorageBackendResult<()>

Pin the transaction’s read snapshot before cache restoration.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§