mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Modularize beacon node backend (#4718)
#4669 Modularize the beacon node backend to make it easier to add new database implementations
This commit is contained in:
@@ -1591,5 +1591,14 @@ pub fn cli_app() -> Command {
|
||||
.action(ArgAction::Set)
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("beacon-node-backend")
|
||||
.long("beacon-node-backend")
|
||||
.value_name("DATABASE")
|
||||
.value_parser(store::config::DatabaseBackend::VARIANTS.to_vec())
|
||||
.help("Set the database backend to be used by the beacon node.")
|
||||
.action(ArgAction::Set)
|
||||
.display_order(0)
|
||||
)
|
||||
.group(ArgGroup::new("enable_http").args(["http", "gui", "staking"]).multiple(true))
|
||||
}
|
||||
|
||||
@@ -432,6 +432,10 @@ pub fn get_config<E: EthSpec>(
|
||||
warn!(log, "The slots-per-restore-point flag is deprecated");
|
||||
}
|
||||
|
||||
if let Some(backend) = clap_utils::parse_optional(cli_args, "beacon-node-backend")? {
|
||||
client_config.store.backend = backend;
|
||||
}
|
||||
|
||||
if let Some(hierarchy_config) = clap_utils::parse_optional(cli_args, "hierarchy-exponents")? {
|
||||
client_config.store.hierarchy_config = hierarchy_config;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ mod cli;
|
||||
mod config;
|
||||
|
||||
pub use beacon_chain;
|
||||
use beacon_chain::store::LevelDB;
|
||||
use beacon_chain::{
|
||||
builder::Witness, eth1_chain::CachingEth1Backend, slot_clock::SystemTimeSlotClock,
|
||||
};
|
||||
@@ -16,11 +15,19 @@ use slasher::{DatabaseBackendOverride, Slasher};
|
||||
use slog::{info, warn};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::sync::Arc;
|
||||
use store::database::interface::BeaconNodeBackend;
|
||||
use types::{ChainSpec, Epoch, EthSpec, ForkName};
|
||||
|
||||
/// A type-alias to the tighten the definition of a production-intended `Client`.
|
||||
pub type ProductionClient<E> =
|
||||
Client<Witness<SystemTimeSlotClock, CachingEth1Backend<E>, E, LevelDB<E>, LevelDB<E>>>;
|
||||
pub type ProductionClient<E> = Client<
|
||||
Witness<
|
||||
SystemTimeSlotClock,
|
||||
CachingEth1Backend<E>,
|
||||
E,
|
||||
BeaconNodeBackend<E>,
|
||||
BeaconNodeBackend<E>,
|
||||
>,
|
||||
>;
|
||||
|
||||
/// The beacon node `Client` that will be used in production.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user