Trait casper_node::components::Component [−][src]
Core Component.
Its inputs are Event
s, allowing it to
perform work whenever an event is received, outputting Effect
s each time it is called.
Error and halting states
Components in general are expected to be able to handle every input (Event
) in every state.
Invalid inputs are supposed to be discarded, and the machine is expected to recover from any
recoverable error states by itself.
If a fatal error occurs that is not recoverable, the reactor should be notified instead.
Component events and reactor events
Each component has two events related to it: An associated Event
and a reactor event (REv
).
The Event
type indicates what type of event a component accepts, these are typically event
types specific to the component.
Components place restrictions on reactor events (REv
s), indicating what kind of effects they
need to be able to produce to operate.
Associated Types
type Event
[src]
Event associated with Component
.
The event type that is handled by the component.
type ConstructionError
[src]
Error emitted when constructing the component.
Required methods
fn handle_event(
&mut self,
effect_builder: EffectBuilder<REv>,
rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>
[src]
&mut self,
effect_builder: EffectBuilder<REv>,
rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>
Processes an event, outputting zero or more effects.
This function must not ever perform any blocking or CPU intensive work, as it is expected to return very quickly.
Implementors
impl<REv> Component<REv> for ContractRuntime where
REv: From<Event> + Send,
[src]
REv: From<Event> + Send,
type Event = Event
type ConstructionError = ConfigError
fn handle_event(
&mut self,
_effect_builder: EffectBuilder<REv>,
_rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>
[src]
&mut self,
_effect_builder: EffectBuilder<REv>,
_rng: &mut NodeRng,
event: Self::Event
) -> Effects<Self::Event>