2025-12-01 12:48:39 +01:00
|
|
|
use async_trait::async_trait;
|
2025-12-16 21:20:27 +01:00
|
|
|
use reqwest::Url;
|
2025-12-01 12:48:39 +01:00
|
|
|
|
|
|
|
|
use super::DynError;
|
|
|
|
|
|
|
|
|
|
/// Marker type used by scenario builders to request node control support.
|
|
|
|
|
#[derive(Clone, Copy, Debug, Default)]
|
|
|
|
|
pub struct NodeControlCapability;
|
|
|
|
|
|
2025-12-16 21:20:27 +01:00
|
|
|
/// Optional observability settings attached to a scenario.
|
|
|
|
|
///
|
|
|
|
|
/// Runners may use this to decide whether to provision in-cluster Prometheus or
|
|
|
|
|
/// reuse an existing endpoint.
|
|
|
|
|
#[derive(Clone, Debug, Default)]
|
|
|
|
|
pub struct ObservabilityCapability {
|
|
|
|
|
pub external_prometheus: Option<Url>,
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-01 12:48:39 +01:00
|
|
|
/// Trait implemented by scenario capability markers to signal whether node
|
|
|
|
|
/// control is required.
|
|
|
|
|
pub trait RequiresNodeControl {
|
|
|
|
|
const REQUIRED: bool;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl RequiresNodeControl for () {
|
|
|
|
|
const REQUIRED: bool = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl RequiresNodeControl for NodeControlCapability {
|
|
|
|
|
const REQUIRED: bool = true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-16 21:20:27 +01:00
|
|
|
impl RequiresNodeControl for ObservabilityCapability {
|
|
|
|
|
const REQUIRED: bool = false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-01 12:48:39 +01:00
|
|
|
/// Interface exposed by runners that can restart nodes at runtime.
|
|
|
|
|
#[async_trait]
|
|
|
|
|
pub trait NodeControlHandle: Send + Sync {
|
|
|
|
|
async fn restart_validator(&self, index: usize) -> Result<(), DynError>;
|
2025-12-09 06:30:18 +01:00
|
|
|
|
2025-12-01 12:48:39 +01:00
|
|
|
async fn restart_executor(&self, index: usize) -> Result<(), DynError>;
|
|
|
|
|
}
|