1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#[derive(Copy, Clone, Debug)]
pub struct DirectoryChainStoreConfig {
pub segment_over_allocate_size: u64,
pub segment_max_size: u64,
pub segment_max_open_mmap: usize,
pub operation_index_max_memory_items: usize,
}
impl Default for DirectoryChainStoreConfig {
fn default() -> Self {
DirectoryChainStoreConfig {
segment_over_allocate_size: 20 * 1024 * 1024,
segment_max_size: 200 * 1024 * 1024,
segment_max_open_mmap: 20,
operation_index_max_memory_items: 10000,
}
}
}
impl From<exocore_protos::core::ChainConfig> for DirectoryChainStoreConfig {
fn from(proto: exocore_protos::core::ChainConfig) -> Self {
let mut config = DirectoryChainStoreConfig::default();
if let Some(val) = proto.segment_max_size {
config.segment_max_size = val;
}
if let Some(val) = proto.segment_max_open_mmap {
config.segment_max_open_mmap = val as usize;
}
config
}
}