reth_engine_tree::chain

Trait ChainHandler

Source
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§

Source

type Event: Send

Event generated by this handler that orchestrator can bubble up;

Required Methods§

Source

fn on_event(&mut self, event: FromOrchestrator)

Informs the handler about an event from the ChainOrchestrator.

Source

fn poll(&mut self, cx: &mut Context<'_>) -> Poll<HandlerEvent<Self::Event>>

Polls for actions that ChainOrchestrator should handle.

Implementors§

Source§

impl<T, S, D> ChainHandler for EngineHandler<T, S, D>
where T: EngineRequestHandler, S: Stream + Send + Sync + Unpin + 'static, <S as Stream>::Item: Into<T::Request>, D: BlockDownloader,