refactor(storage): add with_*_opt builder methods to StorageSettings (#21998)

Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Georgios Konstantopoulos
2026-02-10 21:19:33 -05:00
committed by GitHub
parent 5c93986e6d
commit 3bf9280b3c
2 changed files with 77 additions and 21 deletions

View File

@@ -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 ||