pub trait SlotWorker<B: BlockT, Proof> {
    // Required method
    fn on_slot<'life0, 'async_trait>(
        &'life0 mut self,
        slot_info: SlotInfo<B>
    ) -> Pin<Box<dyn Future<Output = Option<SlotResult<B, Proof>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A worker that should be invoked at every new slot.

The implementation should not make any assumptions of the slot being bound to the time or similar. The only valid assumption is that the slot number is always increasing.

Required Methods§

source

fn on_slot<'life0, 'async_trait>( &'life0 mut self, slot_info: SlotInfo<B> ) -> Pin<Box<dyn Future<Output = Option<SlotResult<B, Proof>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a new slot is triggered.

Returns a future that resolves to a SlotResult iff a block was successfully built in the slot. Otherwise None is returned.

Implementors§

source§

impl<T: SimpleSlotWorker<B> + Send + Sync, B: BlockT> SlotWorker<B, <<T as SimpleSlotWorker<B>>::Proposer as Proposer<B>>::Proof> for SimpleSlotWorkerToSlotWorker<T>