reth_node_core/args/
static_files.rs1use clap::Args;
4use reth_config::config::{BlocksPerFileConfig, StaticFilesConfig};
5use reth_provider::StorageSettings;
6
7#[derive(Debug, Args, PartialEq, Eq, Default, Clone, Copy)]
9#[command(next_help_heading = "Static Files")]
10pub struct StaticFilesArgs {
11 #[arg(long = "static-files.blocks-per-file.headers")]
13 pub blocks_per_file_headers: Option<u64>,
14
15 #[arg(long = "static-files.blocks-per-file.transactions")]
17 pub blocks_per_file_transactions: Option<u64>,
18
19 #[arg(long = "static-files.blocks-per-file.receipts")]
21 pub blocks_per_file_receipts: Option<u64>,
22
23 #[arg(long = "static-files.blocks-per-file.transaction-senders")]
25 pub blocks_per_file_transaction_senders: Option<u64>,
26
27 #[arg(long = "static-files.receipts")]
34 pub receipts: bool,
35
36 #[arg(long = "static-files.transaction-senders")]
44 pub transaction_senders: bool,
45}
46
47impl StaticFilesArgs {
48 pub fn merge_with_config(&self, config: StaticFilesConfig) -> StaticFilesConfig {
51 StaticFilesConfig {
52 blocks_per_file: BlocksPerFileConfig {
53 headers: self.blocks_per_file_headers.or(config.blocks_per_file.headers),
54 transactions: self
55 .blocks_per_file_transactions
56 .or(config.blocks_per_file.transactions),
57 receipts: self.blocks_per_file_receipts.or(config.blocks_per_file.receipts),
58 transaction_senders: self
59 .blocks_per_file_transaction_senders
60 .or(config.blocks_per_file.transaction_senders),
61 },
62 }
63 }
64
65 pub const fn to_settings(&self) -> StorageSettings {
67 StorageSettings::legacy()
68 .with_receipts_in_static_files(self.receipts)
69 .with_transaction_senders_in_static_files(self.transaction_senders)
70 }
71}