hotstuff_rs

Module event_bus

source
Expand description

Thread that receives events emitted by the algorithm and block sync server threads and passes them to event handlers.

When the thread receives a message containing an event, it triggers the execution of all handlers defined for the contained event type, where the handlers for each event type are stored in EventHandlers.

When no handlers are present in a replica’s instance of EventHandlers this thread is not started.

§Event Handlers

A replica’s instance of EventHandlers contains:

  1. The handlers provided upon building the replica via ReplicaSpec, and
  2. If logging is enabled via replica’s config then also the default logging handlers defined in logging.

Structs§

  • Stores the HandlerPair of user-defined and optional logging handlers for each pre-defined event type from events.
  • Stores the two optional handlers enabled for an event type that implements the Logger trait, namely one logging handler, defined in logging, and one user-defined handler, passed to ReplicaSpec.

Functions§

  • Starts the event bus thread, which runs an infinite loop until a shutdown signal is received from the parent thread. In each iteration of the loop, the thread checks if it received any event notifications, and if so, then triggers the execution of the handlers defined for the event.

Type Aliases§

  • HandlerPtr 🔒
    Pointer to a handler closure, parametrised by the argument (for our use case, event) type.