protoflow_core/
block_runtime.rs1use crate::{
4 prelude::{Duration, Instant, Range},
5 BlockError, Port,
6};
7
8pub trait BlockRuntime: Send + Sync {
9 fn is_alive(&self) -> bool;
10
11 fn sleep_for(&self, duration: Duration) -> Result<(), BlockError>;
12
13 fn sleep_until(&self, instant: Instant) -> Result<(), BlockError>; fn wait_for(&self, port: &dyn Port) -> Result<(), BlockError>;
17
18 fn yield_now(&self) -> Result<(), BlockError>;
19
20 fn random_duration(&self, range: Range<Duration>) -> Duration;
21}