Reduce runtime wait surface

This commit is contained in:
andrussal 2026-03-08 13:21:21 +01:00
parent fb4c58cc48
commit 365526d236

View File

@ -121,22 +121,12 @@ impl<E: Application> RunContext<E> {
self.node_control.clone()
}
#[must_use]
pub fn cluster_wait(&self) -> Option<Arc<dyn ClusterWaitHandle<E>>> {
self.cluster_wait.clone()
}
#[must_use]
pub const fn controls_nodes(&self) -> bool {
self.node_control.is_some()
}
#[must_use]
pub const fn can_wait_network_ready(&self) -> bool {
self.cluster_wait.is_some()
}
pub async fn wait_network_ready(&self) -> Result<(), DynError> {
pub(crate) async fn wait_network_ready(&self) -> Result<(), DynError> {
self.require_cluster_wait()?.wait_network_ready().await
}
@ -146,7 +136,9 @@ impl<E: Application> RunContext<E> {
}
fn require_cluster_wait(&self) -> Result<Arc<dyn ClusterWaitHandle<E>>, DynError> {
self.cluster_wait()
self.cluster_wait
.as_ref()
.map(Arc::clone)
.ok_or_else(|| RunContextCapabilityError::MissingClusterWait.into())
}
}
@ -192,10 +184,6 @@ impl<E: Application> RunHandle<E> {
pub fn context(&self) -> &RunContext<E> {
&self.run_context
}
pub async fn wait_network_ready(&self) -> Result<(), DynError> {
self.run_context.wait_network_ready().await
}
}
/// Derived metrics about the current run timing.