events.rs

Overview

This file defines an enumeration named Event which represents distinct events relevant to the application's operational workflow. The Event enum serves as a simple event signaling mechanism within the system, enabling differentiation between types of events that can occur, such as the creation of a new block or the completion of state data download.

Enum: Event

Description

The Event enum encapsulates discrete event types that the system can handle or react to during runtime. It currently contains two variants:

This enum is used to identify and dispatch event types in the codebase, facilitating event-driven programming patterns.

Variants

Variant

Description

NewBlock

Indicates that a new block has been created or detected.

StateDownloaded

Signifies that the full state has been successfully downloaded.

Usage Example

fn handle_event(event: Event) {
    match event {
        Event::NewBlock => println!("A new block has been created."),
        Event::StateDownloaded => println!("The state was downloaded successfully."),
    }
}

In the example above, the handle_event function accepts an Event and performs different actions depending on the variant received.

Implementation Details

Interaction with Other Parts of the System

Diagram: Structure of Event Enum

classDiagram
class Event {
<<enum>>
+NewBlock
+StateDownloaded
}