pub trait ChainHandler: Send + Sync {
type Event: Send;
// Required methods
fn on_event(&mut self, event: FromOrchestrator);
fn poll(&mut self, cx: &mut Context<'_>) -> Poll<HandlerEvent<Self::Event>>;
}Expand description
A trait that advances the chain by handling actions.
This is intended to be implement the chain consensus logic, for example engine API.
§Control flow
The ChainOrchestrator is responsible for advancing this handler through
ChainHandler::poll and handling the emitted events, for example
HandlerEvent::BackfillAction to start a backfill sync. Events from the ChainOrchestrator
are passed to the handler via ChainHandler::on_event, e.g.
FromOrchestrator::BackfillSyncStarted once the backfill sync started or finished.
Required Associated Types§
Required Methods§
Sourcefn on_event(&mut self, event: FromOrchestrator)
fn on_event(&mut self, event: FromOrchestrator)
Informs the handler about an event from the ChainOrchestrator.
Sourcefn poll(&mut self, cx: &mut Context<'_>) -> Poll<HandlerEvent<Self::Event>>
fn poll(&mut self, cx: &mut Context<'_>) -> Poll<HandlerEvent<Self::Event>>
Polls for actions that ChainOrchestrator should handle.