Trait hotshot::TwinsHandlerState

source ·
pub trait TwinsHandlerState<TYPES, I, V>
where Self: Debug + Send + Sync, TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions,
{ // Required methods fn send_handler<'life0, 'life1, 'async_trait>( &'life0 mut self, event: &'life1 HotShotEvent<TYPES>, ) -> Pin<Box<dyn Future<Output = Vec<Either<HotShotEvent<TYPES>, HotShotEvent<TYPES>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn recv_handler<'life0, 'life1, 'async_trait>( &'life0 mut self, event: &'life1 Either<HotShotEvent<TYPES>, HotShotEvent<TYPES>>, ) -> Pin<Box<dyn Future<Output = Vec<HotShotEvent<TYPES>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn fuse_channels( &'static mut self, left: (Sender<Arc<HotShotEvent<TYPES>>>, Receiver<Arc<HotShotEvent<TYPES>>>), right: (Sender<Arc<HotShotEvent<TYPES>>>, Receiver<Arc<HotShotEvent<TYPES>>>), ) -> (Sender<Arc<HotShotEvent<TYPES>>>, Receiver<Arc<HotShotEvent<TYPES>>>) { ... } fn spawn_twin_handles<'async_trait>( &'static mut self, public_key: TYPES::SignatureKey, private_key: <TYPES::SignatureKey as SignatureKey>::PrivateKey, nonce: u64, config: HotShotConfig<TYPES::SignatureKey>, memberships: Arc<RwLock<TYPES::Membership>>, network: Arc<I::Network>, initializer: HotShotInitializer<TYPES>, metrics: ConsensusMetricsValue, storage: I::Storage, marketplace_config: MarketplaceConfig<TYPES, I>, ) -> Pin<Box<dyn Future<Output = (SystemContextHandle<TYPES, I, V>, SystemContextHandle<TYPES, I, V>)> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } }
Expand description

Trait for handling messages for a node with a twin copy of consensus

Required Methods§

source

fn send_handler<'life0, 'life1, 'async_trait>( &'life0 mut self, event: &'life1 HotShotEvent<TYPES>, ) -> Pin<Box<dyn Future<Output = Vec<Either<HotShotEvent<TYPES>, HotShotEvent<TYPES>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle a message sent to the twin from the network task, forwarding it to one of the two twins.

source

fn recv_handler<'life0, 'life1, 'async_trait>( &'life0 mut self, event: &'life1 Either<HotShotEvent<TYPES>, HotShotEvent<TYPES>>, ) -> Pin<Box<dyn Future<Output = Vec<HotShotEvent<TYPES>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle a message from either twin, forwarding it to the network task

Provided Methods§

source

fn fuse_channels( &'static mut self, left: (Sender<Arc<HotShotEvent<TYPES>>>, Receiver<Arc<HotShotEvent<TYPES>>>), right: (Sender<Arc<HotShotEvent<TYPES>>>, Receiver<Arc<HotShotEvent<TYPES>>>), ) -> (Sender<Arc<HotShotEvent<TYPES>>>, Receiver<Arc<HotShotEvent<TYPES>>>)

Fuse two channels into a single channel

Note: the channels are fused using two async loops, whose JoinHandles are dropped.

source

fn spawn_twin_handles<'async_trait>( &'static mut self, public_key: TYPES::SignatureKey, private_key: <TYPES::SignatureKey as SignatureKey>::PrivateKey, nonce: u64, config: HotShotConfig<TYPES::SignatureKey>, memberships: Arc<RwLock<TYPES::Membership>>, network: Arc<I::Network>, initializer: HotShotInitializer<TYPES>, metrics: ConsensusMetricsValue, storage: I::Storage, marketplace_config: MarketplaceConfig<TYPES, I>, ) -> Pin<Box<dyn Future<Output = (SystemContextHandle<TYPES, I, V>, SystemContextHandle<TYPES, I, V>)> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Spawn all tasks that operate on SystemContextHandle.

For a list of which tasks are being spawned, see this module’s documentation.

Implementors§