Squashed changes from modularize-validator-store

This commit is contained in:
Daniel Knopik
2025-03-13 13:07:39 +01:00
committed by Daniel Knopik
parent ac53bee0fd
commit 3316681ea5
42 changed files with 1979 additions and 1589 deletions

View File

@@ -2,6 +2,7 @@
//!
//! For other endpoints, see the `http_api` crate.
use lighthouse_validator_store::LighthouseValidatorStore;
use lighthouse_version::version_with_platform;
use logging::crit;
use malloc_utils::scrape_allocator_metrics;
@@ -15,7 +16,6 @@ use std::time::{SystemTime, UNIX_EPOCH};
use tracing::info;
use types::EthSpec;
use validator_services::duties_service::DutiesService;
use validator_store::ValidatorStore;
use warp::{http::Response, Filter};
#[derive(Debug)]
@@ -36,17 +36,19 @@ impl From<String> for Error {
}
}
type ValidatorStore<E> = LighthouseValidatorStore<SystemTimeSlotClock, E>;
/// Contains objects which have shared access from inside/outside of the metrics server.
pub struct Shared<E: EthSpec> {
pub validator_store: Option<Arc<ValidatorStore<SystemTimeSlotClock, E>>>,
pub duties_service: Option<Arc<DutiesService<SystemTimeSlotClock, E>>>,
pub struct Shared<E> {
pub validator_store: Option<Arc<ValidatorStore<E>>>,
pub duties_service: Option<Arc<DutiesService<ValidatorStore<E>, SystemTimeSlotClock>>>,
pub genesis_time: Option<u64>,
}
/// A wrapper around all the items required to spawn the HTTP server.
///
/// The server will gracefully handle the case where any fields are `None`.
pub struct Context<E: EthSpec> {
pub struct Context<E> {
pub config: Config,
pub shared: RwLock<Shared<E>>,
}