pub struct RunHost { /* private fields */ }Expand description
A model-checking run’s Host.
Implementations§
Source§impl RunHost
impl RunHost
Sourcepub fn new(streams: Streams, config: Option<RunConfig>) -> Self
pub fn new(streams: Streams, config: Option<RunConfig>) -> Self
A host drawing from streams (start-up stream first) and reporting
config for TLCGet("config"). No level and no counter is set.
Sourcepub fn with_inputs(self, inputs: Arc<dyn InputSource>) -> Self
pub fn with_inputs(self, inputs: Arc<dyn InputSource>) -> Self
Installs explicit external input ownership before binding starts.
Sourcepub fn restart(&self)
pub fn restart(&self)
Restarts the start-up stream (trace reconstruction regenerates the initial states from a fresh one, as TLC does).
Sourcepub fn expand(&self, fp: u64)
pub fn expand(&self, fp: u64)
Switches to the stream of the state with fingerprint fp, before the
state is expanded (RandomEnumerableValues’ per-state reseeding).
Sourcepub fn set_stream(&self, stream: Stream)
pub fn set_stream(&self, stream: Stream)
Continues from stream (a snapshot taken with RunHost::stream).
Sourcepub fn skip(&self, words: u64)
pub fn skip(&self, words: u64)
Advances the current stream by words generator steps, as that many
draws of one word each would (one java.util.Random.next call, or
one counter step of dive’s stream). The trace validator uses it to
look for a check’s draws later in a stream.
Sourcepub fn set_level(&self, level: i64)
pub fn set_level(&self, level: i64)
The level TLCGet("level") reports from now on (TLC’s s0.getLevel()).
Sourcepub fn clear_level(&self)
pub fn clear_level(&self)
Stops providing TLCGet("level"), restoring the state before the
engine supplied a level. Other host capabilities are unchanged.
use dive_eval::Host;
use dive_stdlib::{host::RunHost, random::{RandomMode, Streams}};
let host = RunHost::new(Streams::new(0, RandomMode::Dive), None);
host.set_level(3);
host.clear_level();
assert_eq!(host.level(), None);Sourcepub fn set_counter(&self, c: Counter, value: Option<i64>)
pub fn set_counter(&self, c: Counter, value: Option<i64>)
Sets a live counter (None: not provided, so reading it is refused).
Sourcepub fn set_config(&self, config: Option<RunConfig>)
pub fn set_config(&self, config: Option<RunConfig>)
Sets what TLCGet("config") reports.
Sourcepub fn exit_requested(&self) -> bool
pub fn exit_requested(&self) -> bool
Whether the specification asked to stop (TLCSet("exit", TRUE)).
Trait Implementations§
Source§impl Host for RunHost
impl Host for RunHost
Source§fn input(
&self,
request: &InputRequest,
) -> Option<Result<InputResponse, HostError>>
fn input( &self, request: &InputRequest, ) -> Option<Result<InputResponse, HostError>>
Source§fn random(
&self,
op: StdOp,
args: &[Value],
ctx: Ctx,
) -> Option<Result<Value, HostError>>
fn random( &self, op: StdOp, args: &[Value], ctx: Ctx, ) -> Option<Result<Value, HostError>>
RandomElement, RandomSubset,
RandomSetOfSubsets) to its evaluated arguments, drawing from the
stream of the current evaluation: TLC’s start-up stream during
constant definitions, ASSUMEs and Init, and the stream reseeded
from the expanded state’s fingerprint while expanding a state.
None when the host has no stream.Source§fn level(&self) -> Option<i64>
fn level(&self) -> Option<i64>
TLCGet("level") outside ASSUME and Init: the level of TLC’s
s0, the state being expanded in the next-state relation and action
checks, the successor in invariants and constraints (initial states
are level 1).Source§fn request_exit(&self) -> bool
fn request_exit(&self) -> bool
TLCSet("exit", TRUE): ends the run as a success once the current
state is done (ModelChecker.stop). Returns whether the host acts on
it.Source§fn check_native_access(&self, _op: StdOp) -> Result<(), HostError>
fn check_native_access(&self, _op: StdOp) -> Result<(), HostError>
Source§fn print_output(&self, _text: &str) -> Result<bool, HostError>
fn print_output(&self, _text: &str) -> Result<bool, HostError>
false preserves
the operator’s return value while discarding replay output; true
emits the event. Ordinary hosts keep the existing output behavior. Read moreSource§fn check_tlc_access(&self, _key: &str, _write: bool) -> Result<(), HostError>
fn check_tlc_access(&self, _key: &str, _write: bool) -> Result<(), HostError>
Source§fn check_random_in_enabled(&self) -> Result<(), HostError>
fn check_random_in_enabled(&self) -> Result<(), HostError>
ENABLED query, before
evaluating its arguments. Ordinary hosts retain TLC’s behavior. Isolated
sampling/replay hosts may refuse until they can prove the query’s full
random support, including a negative existential result. Read moreSource§fn check_register_access(&self) -> Result<(), HostError>
fn check_register_access(&self) -> Result<(), HostError>
TLCGet reads, aggregate register
reads ("all", "all:named"), and integer/named TLCSet writes.
Other introspection keys do not call this method. The default permits
access, preserving ordinary evaluator and checker behavior. Read moreSource§fn check_action_composition(&self) -> Result<(), HostError>
fn check_action_composition(&self) -> Result<(), HostError>
Source§fn requires_bounded_action_composition(&self) -> bool
fn requires_bounded_action_composition(&self) -> bool
Source§fn check_bounded_action_composition(&self) -> Result<(), HostError>
fn check_bounded_action_composition(&self) -> Result<(), HostError>
Source§fn expression_cache_domain(&self) -> u64
fn expression_cache_domain(&self) -> u64
LazyValue cache). Independent replay gives each run its own domain, so
a value cached by another consumer never becomes replay’s answer and a
replay verdict does not depend on how warm the caches were.Source§fn successor_level(&self) -> Result<i64, HostError>
fn successor_level(&self) -> Result<i64, HostError>
TLCGet("level") under a prime. TLC evaluates a primed expression with
the successor as its current state, so it reads the successor’s level,
which Self::level does not describe. No host tracks it, so the
default refuses by name; a host may remember the refusal so that a
verdict built around a swallowed error is refused too. Read more