pub trait PersistentStorageBackend: Send + Sync {
Show 35 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 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 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 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 drop_btree_index(
&self,
_table: &str,
_field: &ValueIndexKey,
) -> StorageBackendResult<()> { ... }
fn clear_btree_indexes(&self, _table: &str) -> StorageBackendResult<()> { ... }
fn vacuum(&self) -> StorageBackendResult<()> { ... }
fn begin_read_transaction(&self) -> StorageBackendResult<()> { ... }
fn begin_upgradeable_transaction(&self) -> StorageBackendResult<()> { ... }
fn change_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§
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<()>
Sourcefn in_transaction(&self) -> bool
fn in_transaction(&self) -> bool
Whether this session currently owns a pinned storage transaction.
Sourcefn transaction_has_written(&self) -> StorageBackendResult<bool>
fn transaction_has_written(&self) -> StorageBackendResult<bool>
Whether the current transaction has performed a physical write.
The engine uses this to enforce read-only statement transactions even for writes made through catalog/index helpers it did not classify.
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§
Sourcefn storage_identity(
&self,
) -> StorageBackendResult<Option<PersistentStorageIdentity>>
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.
Sourcefn auxiliary_encryption_key(&self) -> Option<StorageEncryptionKey>
fn auxiliary_encryption_key(&self) -> Option<StorageEncryptionKey>
Return the encryption credential for database-owned auxiliary files, including engines constructed directly from this backend.
Sourcefn open_session(&self) -> StorageBackendResult<PersistentStorageSession>
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.
Sourcefn supports_concurrent_pinned_read_and_write(&self) -> bool
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.
Sourcefn migrate_document_storage(&self) -> StorageBackendResult<()>
fn migrate_document_storage(&self) -> StorageBackendResult<()>
Upgrade backend-owned document records before table handles are restored. Implementations must make the rewrite atomic and idempotent.
Sourcefn migrate_inverted_index_storage(&self) -> StorageBackendResult<()>
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.
fn drop_vector_index_metadata( &self, _table: &str, _field: &str, ) -> StorageBackendResult<()>
Sourcefn persists_btree_indexes(&self) -> bool
fn persists_btree_indexes(&self) -> bool
Whether this backend maps logical btree indexes to durable postings.
Sourcefn load_btree_index(
&self,
_table: &str,
_field: &ValueIndexKey,
) -> StorageBackendResult<Option<Vec<(DocId, Value)>>>
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.
fn btree_index_fields( &self, _table: &str, ) -> StorageBackendResult<Vec<ValueIndexKey>>
Sourcefn btree_index_repairs(
&self,
) -> StorageBackendResult<Vec<(String, ValueIndexKey)>>
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.
fn clear_btree_index_repair( &self, _table: &str, _field: &ValueIndexKey, ) -> StorageBackendResult<()>
fn replace_btree_index( &self, _table: &str, _field: &ValueIndexKey, _values: &[(DocId, Value)], ) -> StorageBackendResult<()>
Sourcefn repair_btree_index(
&self,
table: &str,
field: &ValueIndexKey,
complete: &[(DocId, Value)],
_stale_doc_ids: &[DocId],
_missing: &[(DocId, Value)],
) -> StorageBackendResult<()>
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.
Sourcefn replace_btree_indexes(
&self,
table: &str,
indexes: &[(&ValueIndexKey, &[(DocId, Value)])],
) -> StorageBackendResult<()>
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.
fn apply_btree_index_write( &self, _table: &str, _doc_id: DocId, _values: Option<&BTreeMap<ValueIndexKey, Value>>, ) -> StorageBackendResult<()>
fn drop_btree_index( &self, _table: &str, _field: &ValueIndexKey, ) -> StorageBackendResult<()>
fn clear_btree_indexes(&self, _table: &str) -> StorageBackendResult<()>
Sourcefn vacuum(&self) -> StorageBackendResult<()>
fn vacuum(&self) -> StorageBackendResult<()>
Reclaim backend-owned storage 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.
Sourcefn begin_read_transaction(&self) -> StorageBackendResult<()>
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.
Sourcefn begin_upgradeable_transaction(&self) -> StorageBackendResult<()>
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.
Sourcefn change_version(&self) -> StorageBackendResult<Option<u64>>
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.
Sourcefn change_version_monitor_is_nonblocking(&self) -> StorageBackendResult<bool>
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.
Sourcefn pin_transaction_snapshot(&self) -> StorageBackendResult<()>
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".