[−][src]Trait casper_node::reactor::Reactor
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.
Required methods
pub fn dispatch_event(
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>[src]
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>
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]
cfg: Self::Config,
registry: &Registry,
event_queue: EventQueueHandle<Self::Event>,
rng: &mut NodeRng
) -> Result<(Self, Effects<Self::Event>), Self::Error>
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.
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]
&mut self,
_event_queue_handle: EventQueueHandle<Self::Event>
)
Instructs the reactor to update performance metrics, if any.
Implementors
impl Reactor for Initializer[src]
type Event = InitializerEvent
type Error = InitializerError
type Config = WithDir<Config>
pub fn dispatch_event(
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>[src]
&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>[src]
cfg: Self::Config,
registry: &Registry,
event_queue: EventQueueHandle<Self::Event>,
rng: &mut NodeRng
) -> Result<(Self, Effects<Self::Event>), Self::Error>
impl Reactor for casper_node::reactor::initializer::Reactor[src]
type Event = Event
type Config = WithDir<Config>
type Error = Error
pub fn new(
config: Self::Config,
registry: &Registry,
event_queue: EventQueueHandle<Self::Event>,
_rng: &mut NodeRng
) -> Result<(Self, Effects<Self::Event>), Error>[src]
config: Self::Config,
registry: &Registry,
event_queue: EventQueueHandle<Self::Event>,
_rng: &mut NodeRng
) -> Result<(Self, Effects<Self::Event>), Error>
pub fn dispatch_event(
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Event
) -> Effects<Self::Event>[src]
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Event
) -> Effects<Self::Event>
pub fn is_stopped(&mut self) -> bool[src]
impl Reactor for casper_node::reactor::joiner::Reactor[src]
type Event = Event
type Config = WithDir<Reactor>
type Error = Error
pub fn new(
initializer: Self::Config,
registry: &Registry,
event_queue: EventQueueHandle<Self::Event>,
rng: &mut NodeRng
) -> Result<(Self, Effects<Self::Event>), Self::Error>[src]
initializer: Self::Config,
registry: &Registry,
event_queue: EventQueueHandle<Self::Event>,
rng: &mut NodeRng
) -> Result<(Self, Effects<Self::Event>), Self::Error>
pub fn dispatch_event(
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>[src]
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>
pub fn is_stopped(&mut self) -> bool[src]
pub fn update_metrics(
&mut self,
event_queue_handle: EventQueueHandle<Self::Event>
)[src]
&mut self,
event_queue_handle: EventQueueHandle<Self::Event>
)
impl Reactor for casper_node::reactor::validator::Reactor[src]
type Event = Event
type Config = ValidatorInitConfig
type Error = Error
pub fn new(
config: Self::Config,
registry: &Registry,
event_queue: EventQueueHandle<Self::Event>,
_rng: &mut NodeRng
) -> Result<(Self, Effects<Event>), Error>[src]
config: Self::Config,
registry: &Registry,
event_queue: EventQueueHandle<Self::Event>,
_rng: &mut NodeRng
) -> Result<(Self, Effects<Event>), Error>
pub fn dispatch_event(
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Event
) -> Effects<Self::Event>[src]
&mut self,
effect_builder: EffectBuilder<Self::Event>,
rng: &mut NodeRng,
event: Event
) -> Effects<Self::Event>
pub fn update_metrics(
&mut self,
event_queue_handle: EventQueueHandle<Self::Event>
)[src]
&mut self,
event_queue_handle: EventQueueHandle<Self::Event>
)