lighthouse/beacon_node/http_server/src/key.rs

34 lines
645 B
Rust
Raw Normal View History

2019-05-28 08:05:52 +00:00
use crate::metrics::LocalMetrics;
use beacon_chain::{BeaconChain, BeaconChainTypes};
use iron::typemap::Key;
use prometheus::Registry;
use std::marker::PhantomData;
2019-06-01 04:43:08 +00:00
use std::path::PathBuf;
use std::sync::Arc;
pub struct BeaconChainKey<T> {
_phantom: PhantomData<T>,
}
impl<T: BeaconChainTypes + 'static> Key for BeaconChainKey<T> {
type Value = Arc<BeaconChain<T>>;
}
pub struct MetricsRegistryKey;
impl Key for MetricsRegistryKey {
type Value = Registry;
}
2019-05-28 08:05:52 +00:00
pub struct LocalMetricsKey;
impl Key for LocalMetricsKey {
type Value = LocalMetrics;
}
2019-06-01 04:43:08 +00:00
pub struct DBPathKey;
impl Key for DBPathKey {
type Value = PathBuf;
}