cfx_storage/impls/
mod.rs

1// Copyright 2019 Conflux Foundation. All rights reserved.
2// Conflux is free software and distributed under GNU General Public License.
3// See http://www.gnu.org/licenses/
4
5#[macro_use]
6pub(super) mod merkle_patricia_trie;
7pub(super) mod delta_mpt;
8pub(super) mod node_merkle_proof;
9pub(super) mod proof_merger;
10pub(super) mod recording_storage;
11pub(super) mod replicated_state;
12pub(super) mod single_mpt_state;
13pub(super) mod snapshot_sync;
14pub(super) mod state;
15pub(super) mod state_manager;
16pub(super) mod state_proof;
17pub(super) mod storage_db;
18pub(super) mod storage_manager;
19
20pub(super) use cfx_db_errors::storage as errors;
21
22pub mod defaults {
23    pub use super::delta_mpt::DEFAULT_NODE_MAP_SIZE;
24    // By default do not check for data-integrity for snapshot mpt for
25    // production runs.
26    pub const DEFAULT_DEBUG_SNAPSHOT_CHECKER_THREADS: u16 = 0;
27    pub const DEFAULT_DELTA_MPTS_CACHE_RECENT_LFU_FACTOR: f64 =
28        DeltaMptsNodeMemoryManager::R_LFU_FACTOR;
29    pub const DEFAULT_DELTA_MPTS_CACHE_SIZE: u32 =
30        DeltaMptsNodeMemoryManager::MAX_CACHED_TRIE_NODES_DISK_HYBRID;
31    pub const DEFAULT_DELTA_MPTS_CACHE_START_SIZE: u32 =
32        DeltaMptsNodeMemoryManager::START_CAPACITY;
33    pub const DEFAULT_DELTA_MPTS_SLAB_IDLE_SIZE: u32 =
34        DeltaMptsNodeMemoryManager::MAX_DIRTY_AND_TEMPORARY_TRIE_NODES;
35    pub const DEFAULT_EXECUTION_PREFETCH_THREADS: usize = 4;
36    /// Limit the number of open snapshots to set an upper limit on open files
37    /// in Storage subsystem.
38    pub const DEFAULT_MAX_OPEN_SNAPSHOTS: u16 = 10;
39    pub const MAX_CACHED_TRIE_NODES_R_LFU_COUNTER: u32 =
40        DeltaMptsNodeMemoryManager::MAX_CACHED_TRIE_NODES_R_LFU_COUNTER;
41
42    /// The max number of opened MPT databases at the same time.
43    /// Accessing a state currently involves both the intermediate MPT and delta
44    /// MPT, so setting this to 4 allows to access two states at the same
45    /// time.
46    pub const DEFAULT_MAX_OPEN_MPT: u32 = 4;
47
48    use super::delta_mpt::node_memory_manager::DeltaMptsNodeMemoryManager;
49}