pub(crate) struct EventHandlers {Show 27 fields
pub(crate) insert_block_handlers: HandlerPair<InsertBlockEvent>,
pub(crate) commit_block_handlers: HandlerPair<CommitBlockEvent>,
pub(crate) prune_block_handlers: HandlerPair<PruneBlockEvent>,
pub(crate) update_highest_pc_handlers: HandlerPair<UpdateHighestPCEvent>,
pub(crate) update_locked_pc_handlers: HandlerPair<UpdateLockedPCEvent>,
pub(crate) update_highest_tc_handlers: HandlerPair<UpdateHighestTCEvent>,
pub(crate) update_validator_set_handlers: HandlerPair<UpdateValidatorSetEvent>,
pub(crate) propose_handlers: HandlerPair<ProposeEvent>,
pub(crate) nudge_handlers: HandlerPair<NudgeEvent>,
pub(crate) phase_vote_handlers: HandlerPair<PhaseVoteEvent>,
pub(crate) new_view_handlers: HandlerPair<NewViewEvent>,
pub(crate) timeout_vote_handlers: HandlerPair<TimeoutVoteEvent>,
pub(crate) advance_view_handlers: HandlerPair<AdvanceViewEvent>,
pub(crate) receive_proposal_handlers: HandlerPair<ReceiveProposalEvent>,
pub(crate) receive_nudge_handlers: HandlerPair<ReceiveNudgeEvent>,
pub(crate) receive_phase_vote_handlers: HandlerPair<ReceivePhaseVoteEvent>,
pub(crate) receive_new_view_handlers: HandlerPair<ReceiveNewViewEvent>,
pub(crate) receive_timeout_vote_handlers: HandlerPair<ReceiveTimeoutVoteEvent>,
pub(crate) receive_advance_view_handlers: HandlerPair<ReceiveAdvanceViewEvent>,
pub(crate) start_view_handlers: HandlerPair<StartViewEvent>,
pub(crate) view_timeout_handlers: HandlerPair<ViewTimeoutEvent>,
pub(crate) collect_pc_handlers: HandlerPair<CollectPCEvent>,
pub(crate) collect_tc_handlers: HandlerPair<CollectTCEvent>,
pub(crate) start_sync_handlers: HandlerPair<StartSyncEvent>,
pub(crate) end_sync_handlers: HandlerPair<EndSyncEvent>,
pub(crate) receive_sync_request_handlers: HandlerPair<ReceiveSyncRequestEvent>,
pub(crate) send_sync_response_handlers: HandlerPair<SendSyncResponseEvent>,
}
Expand description
Stores the HandlerPair
of user-defined and optional logging handlers for each pre-defined event
type from events.
Fields§
§insert_block_handlers: HandlerPair<InsertBlockEvent>
§commit_block_handlers: HandlerPair<CommitBlockEvent>
§prune_block_handlers: HandlerPair<PruneBlockEvent>
§update_highest_pc_handlers: HandlerPair<UpdateHighestPCEvent>
§update_locked_pc_handlers: HandlerPair<UpdateLockedPCEvent>
§update_highest_tc_handlers: HandlerPair<UpdateHighestTCEvent>
§update_validator_set_handlers: HandlerPair<UpdateValidatorSetEvent>
§propose_handlers: HandlerPair<ProposeEvent>
§nudge_handlers: HandlerPair<NudgeEvent>
§phase_vote_handlers: HandlerPair<PhaseVoteEvent>
§new_view_handlers: HandlerPair<NewViewEvent>
§timeout_vote_handlers: HandlerPair<TimeoutVoteEvent>
§advance_view_handlers: HandlerPair<AdvanceViewEvent>
§receive_proposal_handlers: HandlerPair<ReceiveProposalEvent>
§receive_nudge_handlers: HandlerPair<ReceiveNudgeEvent>
§receive_phase_vote_handlers: HandlerPair<ReceivePhaseVoteEvent>
§receive_new_view_handlers: HandlerPair<ReceiveNewViewEvent>
§receive_timeout_vote_handlers: HandlerPair<ReceiveTimeoutVoteEvent>
§receive_advance_view_handlers: HandlerPair<ReceiveAdvanceViewEvent>
§start_view_handlers: HandlerPair<StartViewEvent>
§view_timeout_handlers: HandlerPair<ViewTimeoutEvent>
§collect_pc_handlers: HandlerPair<CollectPCEvent>
§collect_tc_handlers: HandlerPair<CollectTCEvent>
§start_sync_handlers: HandlerPair<StartSyncEvent>
§end_sync_handlers: HandlerPair<EndSyncEvent>
§receive_sync_request_handlers: HandlerPair<ReceiveSyncRequestEvent>
§send_sync_response_handlers: HandlerPair<SendSyncResponseEvent>
Implementations§
source§impl EventHandlers
impl EventHandlers
sourcepub(crate) fn new(
log: bool,
insert_block_handler: Option<Box<dyn Fn(&InsertBlockEvent) + Send>>,
commit_block_handler: Option<Box<dyn Fn(&CommitBlockEvent) + Send>>,
prune_block_handler: Option<Box<dyn Fn(&PruneBlockEvent) + Send>>,
update_highest_pc_handler: Option<Box<dyn Fn(&UpdateHighestPCEvent) + Send>>,
update_locked_pc_handler: Option<Box<dyn Fn(&UpdateLockedPCEvent) + Send>>,
update_highest_tc_handler: Option<Box<dyn Fn(&UpdateHighestTCEvent) + Send>>,
update_validator_set_handler: Option<Box<dyn Fn(&UpdateValidatorSetEvent) + Send>>,
propose_handler: Option<Box<dyn Fn(&ProposeEvent) + Send>>,
nudge_handler: Option<Box<dyn Fn(&NudgeEvent) + Send>>,
phase_vote_handler: Option<Box<dyn Fn(&PhaseVoteEvent) + Send>>,
new_view_handler: Option<Box<dyn Fn(&NewViewEvent) + Send>>,
timeout_vote_handler: Option<Box<dyn Fn(&TimeoutVoteEvent) + Send>>,
advance_view_handler: Option<Box<dyn Fn(&AdvanceViewEvent) + Send>>,
receive_proposal_handler: Option<Box<dyn Fn(&ReceiveProposalEvent) + Send>>,
receive_nudge_handler: Option<Box<dyn Fn(&ReceiveNudgeEvent) + Send>>,
receive_phase_vote_handler: Option<Box<dyn Fn(&ReceivePhaseVoteEvent) + Send>>,
receive_new_view_handler: Option<Box<dyn Fn(&ReceiveNewViewEvent) + Send>>,
receive_timeout_vote_handler: Option<Box<dyn Fn(&ReceiveTimeoutVoteEvent) + Send>>,
receive_advance_view_handler: Option<Box<dyn Fn(&ReceiveAdvanceViewEvent) + Send>>,
start_view_handler: Option<Box<dyn Fn(&StartViewEvent) + Send>>,
view_timeout_handler: Option<Box<dyn Fn(&ViewTimeoutEvent) + Send>>,
collect_pc_handler: Option<Box<dyn Fn(&CollectPCEvent) + Send>>,
collect_tc_handler: Option<Box<dyn Fn(&CollectTCEvent) + Send>>,
start_sync_handler: Option<Box<dyn Fn(&StartSyncEvent) + Send>>,
end_sync_handler: Option<Box<dyn Fn(&EndSyncEvent) + Send>>,
receive_sync_request_handler: Option<Box<dyn Fn(&ReceiveSyncRequestEvent) + Send>>,
send_sync_response_handler: Option<Box<dyn Fn(&SendSyncResponseEvent) + Send>>,
) -> EventHandlers
pub(crate) fn new( log: bool, insert_block_handler: Option<Box<dyn Fn(&InsertBlockEvent) + Send>>, commit_block_handler: Option<Box<dyn Fn(&CommitBlockEvent) + Send>>, prune_block_handler: Option<Box<dyn Fn(&PruneBlockEvent) + Send>>, update_highest_pc_handler: Option<Box<dyn Fn(&UpdateHighestPCEvent) + Send>>, update_locked_pc_handler: Option<Box<dyn Fn(&UpdateLockedPCEvent) + Send>>, update_highest_tc_handler: Option<Box<dyn Fn(&UpdateHighestTCEvent) + Send>>, update_validator_set_handler: Option<Box<dyn Fn(&UpdateValidatorSetEvent) + Send>>, propose_handler: Option<Box<dyn Fn(&ProposeEvent) + Send>>, nudge_handler: Option<Box<dyn Fn(&NudgeEvent) + Send>>, phase_vote_handler: Option<Box<dyn Fn(&PhaseVoteEvent) + Send>>, new_view_handler: Option<Box<dyn Fn(&NewViewEvent) + Send>>, timeout_vote_handler: Option<Box<dyn Fn(&TimeoutVoteEvent) + Send>>, advance_view_handler: Option<Box<dyn Fn(&AdvanceViewEvent) + Send>>, receive_proposal_handler: Option<Box<dyn Fn(&ReceiveProposalEvent) + Send>>, receive_nudge_handler: Option<Box<dyn Fn(&ReceiveNudgeEvent) + Send>>, receive_phase_vote_handler: Option<Box<dyn Fn(&ReceivePhaseVoteEvent) + Send>>, receive_new_view_handler: Option<Box<dyn Fn(&ReceiveNewViewEvent) + Send>>, receive_timeout_vote_handler: Option<Box<dyn Fn(&ReceiveTimeoutVoteEvent) + Send>>, receive_advance_view_handler: Option<Box<dyn Fn(&ReceiveAdvanceViewEvent) + Send>>, start_view_handler: Option<Box<dyn Fn(&StartViewEvent) + Send>>, view_timeout_handler: Option<Box<dyn Fn(&ViewTimeoutEvent) + Send>>, collect_pc_handler: Option<Box<dyn Fn(&CollectPCEvent) + Send>>, collect_tc_handler: Option<Box<dyn Fn(&CollectTCEvent) + Send>>, start_sync_handler: Option<Box<dyn Fn(&StartSyncEvent) + Send>>, end_sync_handler: Option<Box<dyn Fn(&EndSyncEvent) + Send>>, receive_sync_request_handler: Option<Box<dyn Fn(&ReceiveSyncRequestEvent) + Send>>, send_sync_response_handler: Option<Box<dyn Fn(&SendSyncResponseEvent) + Send>>, ) -> EventHandlers
Creates the handler pairs for all pre-defined event types from events given the user-defined handlers, and information on whether logging is enabled.
sourcepub(crate) fn is_empty(&self) -> bool
pub(crate) fn is_empty(&self) -> bool
Checks if no handlers are defined, i.e., neither user-defined handlers were defined nor logging is enabled.
sourcepub(crate) fn fire_handlers(&self, event: Event)
pub(crate) fn fire_handlers(&self, event: Event)
Triggers the execution of each of the two handlers - the user-defined and the logging handler, if defined - for a given event type from events.
Auto Trait Implementations§
impl Freeze for EventHandlers
impl !RefUnwindSafe for EventHandlers
impl Send for EventHandlers
impl !Sync for EventHandlers
impl Unpin for EventHandlers
impl !UnwindSafe for EventHandlers
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more