use std::sync::Arc;
use lightshuttle_runtime::LifecycleHandle;
use crate::metrics::Metrics;
#[derive(Clone)]
pub struct ControlState<H>
where
H: LifecycleHandle + Clone,
{
pub project: String,
pub handle: H,
pub(crate) metrics: Arc<Metrics>,
}
impl<H> ControlState<H>
where
H: LifecycleHandle + Clone,
{
pub fn new(project: impl Into<String>, handle: H) -> Self {
Self {
project: project.into(),
handle,
metrics: Arc::new(Metrics::for_test()),
}
}
pub fn with_metrics(project: impl Into<String>, handle: H, metrics: Arc<Metrics>) -> Self {
Self {
project: project.into(),
handle,
metrics,
}
}
}