pub trait RocksDBProviderFactory {
// Required methods
fn rocksdb_provider(&self) -> RocksDBProvider;
fn set_pending_rocksdb_batch(&self, batch: WriteBatchWithTransaction<true>);
fn commit_pending_rocksdb_batches(&self) -> ProviderResult<()>;
// Provided methods
fn with_rocksdb_snapshot<F, R>(&self, f: F) -> ProviderResult<R>
where Self: StorageSettingsCache,
F: FnOnce(RocksDBRefArg<'_>) -> ProviderResult<R> { ... }
fn with_rocksdb_batch<F, R>(&self, f: F) -> ProviderResult<R>
where F: FnOnce(RocksBatchArg<'_>) -> ProviderResult<(R, Option<RawRocksDBBatch>)> { ... }
fn with_rocksdb_batch_auto_commit<F, R>(&self, f: F) -> ProviderResult<R>
where F: FnOnce(RocksBatchArg<'_>) -> ProviderResult<(R, Option<RawRocksDBBatch>)> { ... }
}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>)
fn set_pending_rocksdb_batch(&self, batch: WriteBatchWithTransaction<true>)
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.
Sourcefn commit_pending_rocksdb_batches(&self) -> ProviderResult<()>
fn commit_pending_rocksdb_batches(&self) -> ProviderResult<()>
Takes all pending RocksDB batches and commits them.
This drains the pending batches from the lock and commits each one using the RocksDB
provider. Can be called before flush to persist RocksDB writes independently of the
full commit path.
Provided Methods§
Sourcefn with_rocksdb_snapshot<F, R>(&self, f: F) -> ProviderResult<R>
fn with_rocksdb_snapshot<F, R>(&self, f: F) -> ProviderResult<R>
Executes a closure with a RocksDB point-in-time snapshot for consistent reads.
This helper encapsulates RocksDB access for read operations.
On legacy MDBX-only nodes (where storage_v2 is false), this skips creating
the RocksDB snapshot entirely, avoiding unnecessary overhead.
Unlike a transaction-based approach, this works in both read-only and read-write modes since the snapshot provides a consistent view of the data at the time it was created.
Sourcefn with_rocksdb_batch<F, R>(&self, f: F) -> ProviderResult<R>
fn with_rocksdb_batch<F, R>(&self, f: F) -> ProviderResult<R>
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) -> ProviderResult<R>
fn with_rocksdb_batch_auto_commit<F, R>(&self, f: F) -> ProviderResult<R>
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.
Implementors§
impl<C: Send + Sync, N: NodePrimitives> RocksDBProviderFactory for NoopProvider<C, N>
test-utils only.