pub trait DBProvider:
Send
+ Sync
+ Sized
+ 'static {
type Tx: DbTx;
Show 13 methods
// Required methods
fn tx_ref(&self) -> &Self::Tx;
fn tx_mut(&mut self) -> &mut Self::Tx;
fn into_tx(self) -> Self::Tx;
fn prune_modes_ref(&self) -> &PruneModes;
// Provided methods
fn disable_long_read_transaction_safety(self) -> Self { ... }
fn commit(self) -> ProviderResult<bool> { ... }
fn table<T: Table>(&self) -> Result<Vec<KeyValue<T>>, DatabaseError>
where T::Key: Default + Ord { ... }
fn get<T: Table>(
&self,
range: impl RangeBounds<T::Key>,
) -> Result<Vec<KeyValue<T>>, DatabaseError> { ... }
fn cursor_read_collect<T: Table<Key = u64>>(
&self,
range: impl RangeBounds<T::Key>,
) -> ProviderResult<Vec<T::Value>> { ... }
fn cursor_collect<T: Table<Key = u64>>(
&self,
cursor: &mut impl DbCursorRO<T>,
range: impl RangeBounds<T::Key>,
) -> ProviderResult<Vec<T::Value>> { ... }
fn cursor_collect_with_capacity<T: Table<Key = u64>>(
&self,
cursor: &mut impl DbCursorRO<T>,
range: impl RangeBounds<T::Key>,
capacity: usize,
) -> ProviderResult<Vec<T::Value>> { ... }
fn remove<T: Table>(
&self,
range: impl RangeBounds<T::Key>,
) -> Result<usize, DatabaseError>
where Self::Tx: DbTxMut { ... }
fn take<T: Table>(
&self,
range: impl RangeBounds<T::Key>,
) -> Result<Vec<KeyValue<T>>, DatabaseError>
where Self::Tx: DbTxMut { ... }
}
Expand description
Database provider.
Required Associated Types§
Required Methods§
Sourcefn tx_mut(&mut self) -> &mut Self::Tx
fn tx_mut(&mut self) -> &mut Self::Tx
Returns a mutable reference to the underlying transaction.
Sourcefn prune_modes_ref(&self) -> &PruneModes
fn prune_modes_ref(&self) -> &PruneModes
Returns a reference to prune modes.
Provided Methods§
Sourcefn disable_long_read_transaction_safety(self) -> Self
fn disable_long_read_transaction_safety(self) -> Self
Disables long-lived read transaction safety guarantees for leaks prevention and observability improvements.
CAUTION: In most of the cases, you want the safety guarantees for long read transactions enabled. Use this only if you’re sure that no write transaction is open in parallel, meaning that Reth as a node is offline and not progressing.
Sourcefn commit(self) -> ProviderResult<bool>
fn commit(self) -> ProviderResult<bool>
Commit database transaction
Sourcefn get<T: Table>(
&self,
range: impl RangeBounds<T::Key>,
) -> Result<Vec<KeyValue<T>>, DatabaseError>
fn get<T: Table>( &self, range: impl RangeBounds<T::Key>, ) -> Result<Vec<KeyValue<T>>, DatabaseError>
Return a list of entries from the table, based on the given range.
Sourcefn cursor_read_collect<T: Table<Key = u64>>(
&self,
range: impl RangeBounds<T::Key>,
) -> ProviderResult<Vec<T::Value>>
fn cursor_read_collect<T: Table<Key = u64>>( &self, range: impl RangeBounds<T::Key>, ) -> ProviderResult<Vec<T::Value>>
Iterates over read only values in the given table and collects them into a vector.
Early-returns if the range is empty, without opening a cursor transaction.
Sourcefn cursor_collect<T: Table<Key = u64>>(
&self,
cursor: &mut impl DbCursorRO<T>,
range: impl RangeBounds<T::Key>,
) -> ProviderResult<Vec<T::Value>>
fn cursor_collect<T: Table<Key = u64>>( &self, cursor: &mut impl DbCursorRO<T>, range: impl RangeBounds<T::Key>, ) -> ProviderResult<Vec<T::Value>>
Iterates over read only values in the given table and collects them into a vector.
Sourcefn cursor_collect_with_capacity<T: Table<Key = u64>>(
&self,
cursor: &mut impl DbCursorRO<T>,
range: impl RangeBounds<T::Key>,
capacity: usize,
) -> ProviderResult<Vec<T::Value>>
fn cursor_collect_with_capacity<T: Table<Key = u64>>( &self, cursor: &mut impl DbCursorRO<T>, range: impl RangeBounds<T::Key>, capacity: usize, ) -> ProviderResult<Vec<T::Value>>
Iterates over read only values in the given table and collects them into a vector with capacity.
Sourcefn remove<T: Table>(
&self,
range: impl RangeBounds<T::Key>,
) -> Result<usize, DatabaseError>
fn remove<T: Table>( &self, range: impl RangeBounds<T::Key>, ) -> Result<usize, DatabaseError>
Remove list of entries from the table. Returns the number of entries removed.
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.