2019-12-06 03:29:06 +00:00
|
|
|
use serde_derive::{Deserialize, Serialize};
|
|
|
|
use types::{EthSpec, MinimalEthSpec};
|
|
|
|
|
2020-01-10 03:42:49 +00:00
|
|
|
pub const DEFAULT_SLOTS_PER_RESTORE_POINT: u64 = 2048;
|
2020-02-10 00:30:21 +00:00
|
|
|
pub const DEFAULT_BLOCK_CACHE_SIZE: usize = 5;
|
2020-01-10 03:42:49 +00:00
|
|
|
|
2020-02-10 00:30:21 +00:00
|
|
|
/// Database configuration parameters.
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
2019-12-06 03:29:06 +00:00
|
|
|
pub struct StoreConfig {
|
|
|
|
/// Number of slots to wait between storing restore points in the freezer database.
|
|
|
|
pub slots_per_restore_point: u64,
|
2020-02-10 00:30:21 +00:00
|
|
|
/// Maximum number of blocks to store in the in-memory block cache.
|
|
|
|
pub block_cache_size: usize,
|
2019-12-06 03:29:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for StoreConfig {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
2020-01-10 03:42:49 +00:00
|
|
|
// Safe default for tests, shouldn't ever be read by a CLI node.
|
2019-12-06 03:29:06 +00:00
|
|
|
slots_per_restore_point: MinimalEthSpec::slots_per_historical_root() as u64,
|
2020-02-10 00:30:21 +00:00
|
|
|
block_cache_size: DEFAULT_BLOCK_CACHE_SIZE,
|
2019-12-06 03:29:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|