Trait hotshot::tasks::EventTransformerState
source · pub trait EventTransformerState<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>{
// Required methods
fn recv_handler<'life0, 'life1, 'async_trait>(
&'life0 mut self,
event: &'life1 HotShotEvent<TYPES>,
) -> Pin<Box<dyn Future<Output = Vec<HotShotEvent<TYPES>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_handler<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
event: &'life1 HotShotEvent<TYPES>,
public_key: &'life2 TYPES::SignatureKey,
private_key: &'life3 <TYPES::SignatureKey as SignatureKey>::PrivateKey,
upgrade_lock: &'life4 UpgradeLock<TYPES, V>,
consensus: Arc<RwLock<Consensus<TYPES>>>,
) -> Pin<Box<dyn Future<Output = Vec<HotShotEvent<TYPES>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
// Provided methods
fn spawn_handle<'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>> + Send + 'async_trait>>
where Self: Send + 'async_trait { ... }
fn add_network_tasks<'life0, 'async_trait>(
&'static mut self,
handle: &'life0 mut SystemContextHandle<TYPES, I, V>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn add_network_event_tasks(
&self,
handle: &mut SystemContextHandle<TYPES, I, V>,
) { ... }
fn add_network_event_task(
&self,
handle: &mut SystemContextHandle<TYPES, I, V>,
channel: Arc<<I as NodeImplementation<TYPES>>::Network>,
membership: Arc<RwLock<TYPES::Membership>>,
) { ... }
}
Expand description
Trait for intercepting and modifying messages between the network and consensus layers.
Consensus <-> [Byzantine logic layer] <-> Network
Required Methods§
sourcefn recv_handler<'life0, 'life1, 'async_trait>(
&'life0 mut self,
event: &'life1 HotShotEvent<TYPES>,
) -> Pin<Box<dyn Future<Output = Vec<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 HotShotEvent<TYPES>,
) -> Pin<Box<dyn Future<Output = Vec<HotShotEvent<TYPES>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
modify incoming messages from the network
sourcefn send_handler<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
event: &'life1 HotShotEvent<TYPES>,
public_key: &'life2 TYPES::SignatureKey,
private_key: &'life3 <TYPES::SignatureKey as SignatureKey>::PrivateKey,
upgrade_lock: &'life4 UpgradeLock<TYPES, V>,
consensus: Arc<RwLock<Consensus<TYPES>>>,
) -> Pin<Box<dyn Future<Output = Vec<HotShotEvent<TYPES>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn send_handler<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
event: &'life1 HotShotEvent<TYPES>,
public_key: &'life2 TYPES::SignatureKey,
private_key: &'life3 <TYPES::SignatureKey as SignatureKey>::PrivateKey,
upgrade_lock: &'life4 UpgradeLock<TYPES, V>,
consensus: Arc<RwLock<Consensus<TYPES>>>,
) -> Pin<Box<dyn Future<Output = Vec<HotShotEvent<TYPES>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
modify outgoing messages from the network
Provided Methods§
sourcefn spawn_handle<'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>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
fn spawn_handle<'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>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
Creates a SystemContextHandle
with the given even transformer
sourcefn add_network_tasks<'life0, 'async_trait>(
&'static mut self,
handle: &'life0 mut SystemContextHandle<TYPES, I, V>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn add_network_tasks<'life0, 'async_trait>(
&'static mut self,
handle: &'life0 mut SystemContextHandle<TYPES, I, V>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Add byzantine network tasks with the trait
sourcefn add_network_event_tasks(&self, handle: &mut SystemContextHandle<TYPES, I, V>)
fn add_network_event_tasks(&self, handle: &mut SystemContextHandle<TYPES, I, V>)
Adds the NetworkEventTaskState
tasks possibly modifying them as well.
sourcefn add_network_event_task(
&self,
handle: &mut SystemContextHandle<TYPES, I, V>,
channel: Arc<<I as NodeImplementation<TYPES>>::Network>,
membership: Arc<RwLock<TYPES::Membership>>,
)
fn add_network_event_task( &self, handle: &mut SystemContextHandle<TYPES, I, V>, channel: Arc<<I as NodeImplementation<TYPES>>::Network>, membership: Arc<RwLock<TYPES::Membership>>, )
Adds a NetworkEventTaskState
task. Can be reimplemented to modify its behaviour.