pub trait RocksDBProviderFactory {
// Required methods
fn rocksdb_provider(&self) -> RocksDBProvider;
fn set_pending_rocksdb_batch(&self, batch: WriteBatchWithTransaction<true>);
// Provided methods
fn with_rocksdb_tx<F, R>(&self, f: F) -> Result<R, ProviderError>
where Self: StorageSettingsCache,
F: FnOnce(Option<&RocksTx<'_>>) -> Result<R, ProviderError> { ... }
fn with_rocksdb_batch<F, R>(&self, f: F) -> Result<R, ProviderError>
where F: FnOnce(RocksDBBatch<'_>) -> Result<(R, Option<WriteBatchWithTransaction<true>>), ProviderError> { ... }
fn with_rocksdb_batch_auto_commit<F, R>(
&self,
f: F,
) -> Result<R, ProviderError>
where F: FnOnce(RocksDBBatch<'_>) -> Result<(R, Option<WriteBatchWithTransaction<true>>), ProviderError> { ... }
}provider only.Expand description
RocksDB provider factory.
This trait provides access to the RocksDB provider
Required Methods§
Sourcefn rocksdb_provider(&self) -> RocksDBProvider
fn rocksdb_provider(&self) -> RocksDBProvider
Returns the RocksDB provider.
Sourcefn set_pending_rocksdb_batch(&self, batch: WriteBatchWithTransaction<true>)
Available on Unix and crate feature rocksdb only.
fn set_pending_rocksdb_batch(&self, batch: WriteBatchWithTransaction<true>)
rocksdb only.Adds a pending RocksDB batch to be committed when this provider is committed.
This allows deferring RocksDB commits to happen at the same time as MDBX and static file
commits, ensuring atomicity across all storage backends.
Provided Methods§
Sourcefn with_rocksdb_tx<F, R>(&self, f: F) -> Result<R, ProviderError>
fn with_rocksdb_tx<F, R>(&self, f: F) -> Result<R, ProviderError>
Executes a closure with a RocksDB transaction for reading.
This helper encapsulates all the cfg-gated RocksDB transaction handling for reads.
On legacy MDBX-only nodes (where any_in_rocksdb() is false), this skips creating
the RocksDB transaction entirely, avoiding unnecessary overhead.
Sourcefn with_rocksdb_batch<F, R>(&self, f: F) -> Result<R, ProviderError>where
F: FnOnce(RocksDBBatch<'_>) -> Result<(R, Option<WriteBatchWithTransaction<true>>), ProviderError>,
fn with_rocksdb_batch<F, R>(&self, f: F) -> Result<R, ProviderError>where
F: FnOnce(RocksDBBatch<'_>) -> Result<(R, Option<WriteBatchWithTransaction<true>>), ProviderError>,
Executes a closure with a RocksDB batch, automatically registering it for commit.
This helper encapsulates all the cfg-gated RocksDB batch handling.
Sourcefn with_rocksdb_batch_auto_commit<F, R>(&self, f: F) -> Result<R, ProviderError>where
F: FnOnce(RocksDBBatch<'_>) -> Result<(R, Option<WriteBatchWithTransaction<true>>), ProviderError>,
fn with_rocksdb_batch_auto_commit<F, R>(&self, f: F) -> Result<R, ProviderError>where
F: FnOnce(RocksDBBatch<'_>) -> Result<(R, Option<WriteBatchWithTransaction<true>>), ProviderError>,
Executes a closure with a RocksDB batch that auto-commits on threshold.
Unlike Self::with_rocksdb_batch, this uses a batch that automatically commits
when it exceeds the size threshold, preventing OOM during large bulk writes.
The consistency check on startup heals any crash between auto-commits.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.