mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
refactor(storage): add with_*_opt builder methods to StorageSettings (#21998)
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
committed by
GitHub
parent
5c93986e6d
commit
3bf9280b3c
@@ -135,6 +135,74 @@ impl StorageSettings {
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets `receipts_in_static_files` if `value` is `Some`.
|
||||
pub const fn with_receipts_in_static_files_opt(mut self, value: Option<bool>) -> Self {
|
||||
if let Some(v) = value {
|
||||
self.receipts_in_static_files = v;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets `transaction_senders_in_static_files` if `value` is `Some`.
|
||||
pub const fn with_transaction_senders_in_static_files_opt(
|
||||
mut self,
|
||||
value: Option<bool>,
|
||||
) -> Self {
|
||||
if let Some(v) = value {
|
||||
self.transaction_senders_in_static_files = v;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets `account_changesets_in_static_files` if `value` is `Some`.
|
||||
pub const fn with_account_changesets_in_static_files_opt(
|
||||
mut self,
|
||||
value: Option<bool>,
|
||||
) -> Self {
|
||||
if let Some(v) = value {
|
||||
self.account_changesets_in_static_files = v;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets `storage_changesets_in_static_files` if `value` is `Some`.
|
||||
pub const fn with_storage_changesets_in_static_files_opt(
|
||||
mut self,
|
||||
value: Option<bool>,
|
||||
) -> Self {
|
||||
if let Some(v) = value {
|
||||
self.storage_changesets_in_static_files = v;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets `transaction_hash_numbers_in_rocksdb` if `value` is `Some`.
|
||||
pub const fn with_transaction_hash_numbers_in_rocksdb_opt(
|
||||
mut self,
|
||||
value: Option<bool>,
|
||||
) -> Self {
|
||||
if let Some(v) = value {
|
||||
self.transaction_hash_numbers_in_rocksdb = v;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets `storages_history_in_rocksdb` if `value` is `Some`.
|
||||
pub const fn with_storages_history_in_rocksdb_opt(mut self, value: Option<bool>) -> Self {
|
||||
if let Some(v) = value {
|
||||
self.storages_history_in_rocksdb = v;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets `account_history_in_rocksdb` if `value` is `Some`.
|
||||
pub const fn with_account_history_in_rocksdb_opt(mut self, value: Option<bool>) -> Self {
|
||||
if let Some(v) = value {
|
||||
self.account_history_in_rocksdb = v;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns `true` if any tables are configured to be stored in `RocksDB`.
|
||||
pub const fn any_in_rocksdb(&self) -> bool {
|
||||
self.transaction_hash_numbers_in_rocksdb ||
|
||||
|
||||
Reference in New Issue
Block a user