cuprated/config/
storage.rs1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5use cuprate_blockchain::config::CacheSizes;
6use cuprate_helper::fs::CUPRATE_DATA_DIR;
7
8use super::{default::DefaultOrCustom, macros::config_struct};
9
10config_struct! {
11 #[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
13 #[serde(deny_unknown_fields, default)]
14 pub struct StorageConfig {
15 #[comment_out = true]
16 pub reader_threads: usize,
24
25 #[comment_out = true]
26 pub fjall_cache_size: DefaultOrCustom<u64>,
34
35 #[child = true]
36 pub txpool: TxpoolConfig,
38
39 #[child = true]
40 pub blockchain: BlockchainConfig,
42 }
43}
44
45impl Default for StorageConfig {
46 fn default() -> Self {
47 Self {
48 reader_threads: cuprate_helper::thread::threads().get() * 4,
49 fjall_cache_size: DefaultOrCustom::Default,
50 txpool: Default::default(),
51 blockchain: Default::default(),
52 }
53 }
54}
55
56config_struct! {
57 #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
59 #[serde(deny_unknown_fields, default)]
60 pub struct TxpoolConfig {
61 pub max_txpool_byte_size: usize,
67
68 pub maximum_age_secs: u64,
75 }
76}
77
78config_struct! {
79 #[derive(Default, Debug, Deserialize, Serialize, PartialEq, Eq)]
81 #[serde(deny_unknown_fields, default)]
82 pub struct BlockchainConfig {
83 #[inline = true]
84 #[comment_out = true]
85 pub tapes_cache_sizes: CacheSizes,
89 }
90}
91
92impl Default for TxpoolConfig {
93 fn default() -> Self {
94 Self {
95 max_txpool_byte_size: 100_000_000,
96 maximum_age_secs: 60 * 60 * 24,
97 }
98 }
99}