reth_node_core/args/
static_files.rs1use clap::Args;
4use reth_config::config::{BlocksPerFileConfig, StaticFilesConfig};
5
6pub const MINIMAL_BLOCKS_PER_FILE: u64 = 10000;
10
11#[derive(Debug, Args, PartialEq, Eq, Clone, Copy, Default)]
13#[command(next_help_heading = "Static Files")]
14pub struct StaticFilesArgs {
15 #[arg(long = "static-files.blocks-per-file.headers")]
17 pub blocks_per_file_headers: Option<u64>,
18
19 #[arg(long = "static-files.blocks-per-file.transactions")]
21 pub blocks_per_file_transactions: Option<u64>,
22
23 #[arg(long = "static-files.blocks-per-file.receipts")]
25 pub blocks_per_file_receipts: Option<u64>,
26
27 #[arg(long = "static-files.blocks-per-file.transaction-senders")]
29 pub blocks_per_file_transaction_senders: Option<u64>,
30
31 #[arg(long = "static-files.blocks-per-file.account-change-sets")]
33 pub blocks_per_file_account_change_sets: Option<u64>,
34
35 #[arg(long = "static-files.blocks-per-file.storage-change-sets")]
37 pub blocks_per_file_storage_change_sets: Option<u64>,
38}
39
40impl StaticFilesArgs {
41 pub fn merge_with_config(&self, config: StaticFilesConfig, minimal: bool) -> StaticFilesConfig {
47 let minimal_blocks_per_file = minimal.then_some(MINIMAL_BLOCKS_PER_FILE);
48 StaticFilesConfig {
49 blocks_per_file: BlocksPerFileConfig {
50 headers: self
51 .blocks_per_file_headers
52 .or(minimal_blocks_per_file)
53 .or(config.blocks_per_file.headers),
54 transactions: self
55 .blocks_per_file_transactions
56 .or(minimal_blocks_per_file)
57 .or(config.blocks_per_file.transactions),
58 receipts: self
59 .blocks_per_file_receipts
60 .or(minimal_blocks_per_file)
61 .or(config.blocks_per_file.receipts),
62 transaction_senders: self
63 .blocks_per_file_transaction_senders
64 .or(minimal_blocks_per_file)
65 .or(config.blocks_per_file.transaction_senders),
66 account_change_sets: self
67 .blocks_per_file_account_change_sets
68 .or(minimal_blocks_per_file)
69 .or(config.blocks_per_file.account_change_sets),
70 storage_change_sets: self
71 .blocks_per_file_storage_change_sets
72 .or(minimal_blocks_per_file)
73 .or(config.blocks_per_file.storage_change_sets),
74 },
75 }
76 }
77}