Trait component::Manageable
source · [−]pub trait Manageable {
fn start<'life0, 'async_trait>(
&'life0 self,
tx_irrecoverable: Sender<Error>,
rx_cancellation: oneshotReceiver<()>
) -> Pin<Box<dyn Future<Output = JoinHandle<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn handle_irrecoverable(
&mut self,
irrecoverable: IrrecoverableError
) -> Result<(), Error>;
}
Expand description
In order to be Manageable, a user defines the following two functions:
- A start function that launches a tokio task, as input it takes:
- an irrecoverable error sender, on which the component sends information to the supervisor about an irrecoverable event that has occurred
- a cancellation handle, which will be listened to in the task once an irrecoverable message has been sent, used as an “ack” that the message has been received and so the function can return
- A handle_irrecoverable which takes actions on a relaunch due to an irrecoverable error that happened. It takes the error message that may contain a stack trace and other information that was sent to the Supervisor via the tx_irrecoverable passed into start.