pub trait StorageBackend: Send + Sync {
// Required methods
fn begin_write(&self) -> Result<Box<dyn WriteTxn + '_>, TalaDbError>;
fn begin_read(&self) -> Result<Box<dyn ReadTxn + '_>, TalaDbError>;
// Provided methods
fn compact(&self) -> Result<(), TalaDbError> { ... }
fn set_durability(&self, _eventual: bool) { ... }
fn flush(&self) -> Result<(), TalaDbError> { ... }
}Required Methods§
fn begin_write(&self) -> Result<Box<dyn WriteTxn + '_>, TalaDbError>
fn begin_read(&self) -> Result<Box<dyn ReadTxn + '_>, TalaDbError>
Provided Methods§
Sourcefn compact(&self) -> Result<(), TalaDbError>
fn compact(&self) -> Result<(), TalaDbError>
Compact the underlying storage, reclaiming space from deleted/updated records. No-op on backends that manage compaction automatically.
Sourcefn set_durability(&self, _eventual: bool)
fn set_durability(&self, _eventual: bool)
Set write durability. eventual = false (default) fsyncs every commit;
true batches commits for throughput, requiring flush
to force a durable sync. No-op on backends without a durability knob.
Sourcefn flush(&self) -> Result<(), TalaDbError>
fn flush(&self) -> Result<(), TalaDbError>
Force any batched (eventual) commits to durable storage. No-op on in-memory backends and when already committing immediately.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".