pub struct ActorModel<A, C = (), H = ()>{
pub actors: Vec<A>,
pub cfg: C,
pub init_history: H,
pub init_network: Network<A::Msg>,
pub lossy_network: LossyNetwork,
pub max_crashes: usize,
pub properties: Vec<Property<ActorModel<A, C, H>>>,
pub record_msg_in: fn(cfg: &C, history: &H, envelope: Envelope<&A::Msg>) -> Option<H>,
pub record_msg_out: fn(cfg: &C, history: &H, envelope: Envelope<&A::Msg>) -> Option<H>,
pub within_boundary: fn(cfg: &C, state: &ActorModelState<A, H>) -> bool,
}Expand description
Represents a system of Actors that communicate over a network. H indicates the type of
history to maintain as auxiliary state, if any. See Auxiliary Variables in
TLA for a thorough
introduction to that concept. Use () if history is not needed to define the relevant
properties of this system.
Fields§
§actors: Vec<A>§cfg: C§init_history: H§init_network: Network<A::Msg>§lossy_network: LossyNetwork§max_crashes: usizeMaximum number of actors that can be contemporarily crashed
properties: Vec<Property<ActorModel<A, C, H>>>§record_msg_in: fn(cfg: &C, history: &H, envelope: Envelope<&A::Msg>) -> Option<H>§record_msg_out: fn(cfg: &C, history: &H, envelope: Envelope<&A::Msg>) -> Option<H>§within_boundary: fn(cfg: &C, state: &ActorModelState<A, H>) -> boolImplementations§
Source§impl<A, C, H> ActorModel<A, C, H>
impl<A, C, H> ActorModel<A, C, H>
Sourcepub fn new(cfg: C, init_history: H) -> ActorModel<A, C, H>
pub fn new(cfg: C, init_history: H) -> ActorModel<A, C, H>
Initializes an ActorModel with a specified configuration and history.
Sourcepub fn actors(self, actors: impl IntoIterator<Item = A>) -> Self
pub fn actors(self, actors: impl IntoIterator<Item = A>) -> Self
Adds multiple Actors to this model.
Sourcepub fn init_network(self, init_network: Network<A::Msg>) -> Self
pub fn init_network(self, init_network: Network<A::Msg>) -> Self
Defines the initial network.
Sourcepub fn lossy_network(self, lossy_network: LossyNetwork) -> Self
pub fn lossy_network(self, lossy_network: LossyNetwork) -> Self
Defines whether the network loses messages or not.
Sourcepub fn max_crashes(self, max_crashes: usize) -> Self
pub fn max_crashes(self, max_crashes: usize) -> Self
Specifies the maximum number of actors that can be contemporarily crashed
Sourcepub fn property(
self,
expectation: Expectation,
name: &'static str,
condition: fn(&ActorModel<A, C, H>, &ActorModelState<A, H>) -> bool,
) -> Self
pub fn property( self, expectation: Expectation, name: &'static str, condition: fn(&ActorModel<A, C, H>, &ActorModelState<A, H>) -> bool, ) -> Self
Adds a Property to this model.
Sourcepub fn record_msg_in(
self,
record_msg_in: fn(cfg: &C, history: &H, _: Envelope<&A::Msg>) -> Option<H>,
) -> Self
pub fn record_msg_in( self, record_msg_in: fn(cfg: &C, history: &H, _: Envelope<&A::Msg>) -> Option<H>, ) -> Self
Defines whether/how an incoming message contributes to relevant history. Returning
Some(new_history) updates the relevant history, while None does not.
Sourcepub fn record_msg_out(
self,
record_msg_out: fn(cfg: &C, history: &H, _: Envelope<&A::Msg>) -> Option<H>,
) -> Self
pub fn record_msg_out( self, record_msg_out: fn(cfg: &C, history: &H, _: Envelope<&A::Msg>) -> Option<H>, ) -> Self
Defines whether/how an outgoing message contributes to relevant history. Returning
Some(new_history) updates the relevant history, while None does not.
Sourcepub fn within_boundary(
self,
within_boundary: fn(cfg: &C, state: &ActorModelState<A, H>) -> bool,
) -> Self
pub fn within_boundary( self, within_boundary: fn(cfg: &C, state: &ActorModelState<A, H>) -> bool, ) -> Self
Indicates whether a state is within the state space that should be model checked.
Trait Implementations§
Source§impl<A, C: Clone, H> Clone for ActorModel<A, C, H>
impl<A, C: Clone, H> Clone for ActorModel<A, C, H>
Source§fn clone(&self) -> ActorModel<A, C, H>
fn clone(&self) -> ActorModel<A, C, H>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<A, C, H> Model for ActorModel<A, C, H>
impl<A, C, H> Model for ActorModel<A, C, H>
Source§fn as_svg(&self, path: Path<Self::State, Self::Action>) -> Option<String>
fn as_svg(&self, path: Path<Self::State, Self::Action>) -> Option<String>
Draws a sequence diagram for the actor system.
Source§type State = ActorModelState<A, H>
type State = ActorModelState<A, H>
Source§type Action = ActorModelAction<<A as Actor>::Msg, <A as Actor>::Timer, <A as Actor>::Random>
type Action = ActorModelAction<<A as Actor>::Msg, <A as Actor>::Timer, <A as Actor>::Random>
Source§fn actions(&self, state: &Self::State, actions: &mut Vec<Self::Action>)
fn actions(&self, state: &Self::State, actions: &mut Vec<Self::Action>)
Source§fn next_state(
&self,
last_sys_state: &Self::State,
action: Self::Action,
) -> Option<Self::State>
fn next_state( &self, last_sys_state: &Self::State, action: Self::Action, ) -> Option<Self::State>
None indicates that the action
does not change the state.Source§fn format_action(&self, action: &Self::Action) -> String
fn format_action(&self, action: &Self::Action) -> String
Source§fn format_step(
&self,
last_state: &Self::State,
action: Self::Action,
) -> Option<String>
fn format_step( &self, last_state: &Self::State, action: Self::Action, ) -> Option<String>
Source§fn properties(&self) -> Vec<Property<Self>>
fn properties(&self) -> Vec<Property<Self>>
Source§fn within_boundary(&self, state: &Self::State) -> bool
fn within_boundary(&self, state: &Self::State) -> bool
Source§fn next_steps(
&self,
last_state: &Self::State,
) -> Vec<(Self::Action, Self::State)>
fn next_steps( &self, last_state: &Self::State, ) -> Vec<(Self::Action, Self::State)>
Source§fn next_states(&self, last_state: &Self::State) -> Vec<Self::State>
fn next_states(&self, last_state: &Self::State) -> Vec<Self::State>
Model::next_steps and projecting out the states.