Skip to content

Commit 0eaffdf

Browse files
authored
feat: add StorageSettings for StoragesHistory in RocksDB (#20154)
1 parent 9c141ca commit 0eaffdf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

crates/cli/commands/src/db/settings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ impl Command {
9191
let mut settings @ StorageSettings {
9292
receipts_in_static_files: _,
9393
transaction_senders_in_static_files: _,
94+
storages_history_in_rocksdb: _,
9495
} = settings.unwrap_or_else(StorageSettings::legacy);
9596

9697
// Update the setting based on the key

crates/storage/db-api/src/models/metadata.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ pub struct StorageSettings {
1919
/// Whether this node always writes transaction senders to static files.
2020
#[serde(default)]
2121
pub transaction_senders_in_static_files: bool,
22+
/// Whether `StoragesHistory` is stored in `RocksDB`.
23+
#[serde(default)]
24+
pub storages_history_in_rocksdb: bool,
2225
}
2326

2427
impl StorageSettings {
@@ -28,7 +31,11 @@ impl StorageSettings {
2831
/// `false`, ensuring older nodes continue writing receipts and transaction senders to the
2932
/// database when receipt pruning is enabled.
3033
pub const fn legacy() -> Self {
31-
Self { receipts_in_static_files: false, transaction_senders_in_static_files: false }
34+
Self {
35+
receipts_in_static_files: false,
36+
transaction_senders_in_static_files: false,
37+
storages_history_in_rocksdb: false,
38+
}
3239
}
3340

3441
/// Sets the `receipts_in_static_files` flag to the provided value.
@@ -42,4 +49,10 @@ impl StorageSettings {
4249
self.transaction_senders_in_static_files = value;
4350
self
4451
}
52+
53+
/// Sets the `storages_history_in_rocksdb` flag to the provided value.
54+
pub const fn with_storages_history_in_rocksdb(mut self, value: bool) -> Self {
55+
self.storages_history_in_rocksdb = value;
56+
self
57+
}
4558
}

0 commit comments

Comments
 (0)