[][src]Trait casper_node::reactor::Reactor

pub trait Reactor: Sized {
    type Event: Send + Debug + Display + 'static;
    type Config;
    type Error: Send + 'static;
    pub fn dispatch_event(
        &mut self,
        effect_builder: EffectBuilder<Self::Event>,
        rng: &mut NodeRng,
        event: Self::Event
    ) -> Effects<Self::Event>;
pub fn new(
        cfg: Self::Config,
        registry: &Registry,
        event_queue: EventQueueHandle<Self::Event>,
        rng: &mut NodeRng
    ) -> Result<(Self, Effects<Self::Event>), Self::Error>; pub fn is_stopped(&mut self) -> bool { ... }
pub fn update_metrics(
        &mut self,
        _event_queue_handle: EventQueueHandle<Self::Event>
    ) { ... } }

Reactor core.

Any reactor should implement this trait and be executed by the reactor::run function.

Associated Types

type Event: Send + Debug + Display + 'static[src]

Event type associated with reactor.

Defines what kind of event the reactor processes.

type Config[src]

A configuration for the reactor

type Error: Send + 'static[src]

The error type returned by the reactor.

Loading content...

Required methods

pub fn dispatch_event(
    &mut self,
    effect_builder: EffectBuilder<Self::Event>,
    rng: &mut NodeRng,
    event: Self::Event
) -> Effects<Self::Event>
[src]

Dispatches an event on the reactor.

This function is typically only called by the reactor itself to dispatch an event. It is safe to call regardless, but will cause the event to skip the queue and things like accounting.

pub fn new(
    cfg: Self::Config,
    registry: &Registry,
    event_queue: EventQueueHandle<Self::Event>,
    rng: &mut NodeRng
) -> Result<(Self, Effects<Self::Event>), Self::Error>
[src]

Creates a new instance of the reactor.

This method creates the full state, which consists of all components, and returns a reactor instance along with the effects that the components generated upon instantiation.

If any instantiation fails, an error is returned.

Loading content...

Provided methods

pub fn is_stopped(&mut self) -> bool[src]

Indicates that the reactor has completed all its work and should no longer dispatch events.

pub fn update_metrics(
    &mut self,
    _event_queue_handle: EventQueueHandle<Self::Event>
)
[src]

Instructs the reactor to update performance metrics, if any.

Loading content...

Implementors

impl Reactor for Initializer[src]

type Event = InitializerEvent

type Error = InitializerError

type Config = WithDir<Config>

impl Reactor for casper_node::reactor::initializer::Reactor[src]

type Event = Event

type Config = WithDir<Config>

type Error = Error

impl Reactor for casper_node::reactor::joiner::Reactor[src]

type Event = Event

type Config = WithDir<Reactor>

type Error = Error

impl Reactor for casper_node::reactor::validator::Reactor[src]

type Event = Event

type Config = ValidatorInitConfig

type Error = Error

Loading content...