mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Store blobs in separate freezer or historical state freezer
This commit is contained in:
@@ -68,6 +68,7 @@ pub struct ClientBuilder<T: BeaconChainTypes> {
|
||||
gossipsub_registry: Option<Registry>,
|
||||
db_path: Option<PathBuf>,
|
||||
freezer_db_path: Option<PathBuf>,
|
||||
blobs_freezer_db_path: Option<PathBuf>,
|
||||
http_api_config: http_api::Config,
|
||||
http_metrics_config: http_metrics::Config,
|
||||
slasher: Option<Arc<Slasher<T::EthSpec>>>,
|
||||
@@ -100,6 +101,7 @@ where
|
||||
gossipsub_registry: None,
|
||||
db_path: None,
|
||||
freezer_db_path: None,
|
||||
blobs_freezer_db_path: None,
|
||||
http_api_config: <_>::default(),
|
||||
http_metrics_config: <_>::default(),
|
||||
slasher: None,
|
||||
@@ -892,6 +894,7 @@ where
|
||||
mut self,
|
||||
hot_path: &Path,
|
||||
cold_path: &Path,
|
||||
cold_blobs_path: Option<PathBuf>,
|
||||
config: StoreConfig,
|
||||
log: Logger,
|
||||
) -> Result<Self, String> {
|
||||
@@ -907,6 +910,7 @@ where
|
||||
|
||||
self.db_path = Some(hot_path.into());
|
||||
self.freezer_db_path = Some(cold_path.into());
|
||||
self.blobs_freezer_db_path = cold_blobs_path;
|
||||
|
||||
let inner_spec = spec.clone();
|
||||
let deposit_contract_deploy_block = context
|
||||
@@ -929,6 +933,7 @@ where
|
||||
let store = HotColdDB::open(
|
||||
hot_path,
|
||||
cold_path,
|
||||
cold_blobs_path,
|
||||
schema_upgrade,
|
||||
config,
|
||||
spec,
|
||||
|
||||
@@ -49,6 +49,9 @@ pub struct Config {
|
||||
pub db_name: String,
|
||||
/// Path where the freezer database will be located.
|
||||
pub freezer_db_path: Option<PathBuf>,
|
||||
/// Path where the blobs freezer database will be located if it should be separate from the
|
||||
/// historical state freezer.
|
||||
pub blobs_freezer_db_path: Option<PathBuf>,
|
||||
pub log_file: PathBuf,
|
||||
/// If true, the node will use co-ordinated junk for eth1 values.
|
||||
///
|
||||
@@ -89,6 +92,7 @@ impl Default for Config {
|
||||
data_dir: PathBuf::from(DEFAULT_ROOT_DIR),
|
||||
db_name: "chain_db".to_string(),
|
||||
freezer_db_path: None,
|
||||
blobs_freezer_db_path: None,
|
||||
log_file: PathBuf::from(""),
|
||||
genesis: <_>::default(),
|
||||
store: <_>::default(),
|
||||
@@ -149,11 +153,28 @@ impl Config {
|
||||
.unwrap_or_else(|| self.default_freezer_db_path())
|
||||
}
|
||||
|
||||
/// Returns the path to which the client may initialize the on-disk blobs freezer database.
|
||||
///
|
||||
/// Will attempt to use the user-supplied path from e.g. the CLI, or will default
|
||||
/// to None.
|
||||
pub fn get_blobs_freezer_db_path(&self) -> Option<PathBuf> {
|
||||
self.blobs_freezer_db_path.clone()
|
||||
}
|
||||
|
||||
/// Get the freezer DB path, creating it if necessary.
|
||||
pub fn create_freezer_db_path(&self) -> Result<PathBuf, String> {
|
||||
ensure_dir_exists(self.get_freezer_db_path())
|
||||
}
|
||||
|
||||
/// Get the blobs freezer DB path, creating it if necessary.
|
||||
pub fn create_blobs_freezer_db_path(&self) -> Result<Option<PathBuf>, String> {
|
||||
if let Some(blobs_freezer_path) = self.get_blobs_freezer_db_path() {
|
||||
Ok(Some(ensure_dir_exists(blobs_freezer_path)?))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the "modern" path to the data_dir.
|
||||
///
|
||||
/// See `Self::get_data_dir` documentation for more info.
|
||||
|
||||
Reference in New Issue
Block a user