crb_runtime/
context.rs

1//! A context for composable blocks.
2
3/// A commont methods of all contexts and spans for tracing and logging.
4///
5/// The have provide a reference to a label.
6pub trait ReachableContext: Send {
7    /// An address to interact with the context.
8    type Address: Send + Clone;
9
10    // TODO: A label that used for logging all events around the context.
11    // fn label(&self) -> &Label;
12
13    /// A reference to an address.
14    fn address(&self) -> &Self::Address;
15}
16
17/// The main features of composable block's context.
18///
19/// It could be interrupted and contains a method to check a life status of a composable block.
20pub trait ManagedContext: Send {
21    fn is_alive(&self) -> bool;
22
23    /// Marks a context as interrupted.
24    fn shutdown(&mut self);
25
26    fn stop(&mut self);
27}