Skip to main content

Sim

Struct Sim 

Source
pub struct Sim {
Show 29 fields pub fake: Fake, pub core: Option<Core<Fake, MemStore>>, pub posture: Posture, pub boots: u64, fresh_boot: bool, daemon_pid: u32, held: bool, crash: Option<CrashPoint>, pub start: Timestamp, pub responses: Vec<Response>, pub notices: Vec<String>, pub base: GenerationId, pub candidate: Option<GenerationId>, pub log: Vec<LogRecord>, pub seen_status: BTreeMap<UnitId, BTreeSet<String>>, pub seen_incidents: BTreeMap<IncidentId, Incident>, pub first_incident_at: BTreeMap<UnitId, Timestamp>, pub pre_status: BTreeMap<UnitId, String>, pub touched: BTreeSet<UnitId>, history: Vec<Entry>, compacted: bool, torn_seen: bool, held_tokens: Vec<Hash>, timeline: BTreeMap<UnitId, Vec<(Timestamp, String)>>, foreground_steps: Vec<(Timestamp, String, bool)>, start_probe_defs: String, start_work: (usize, usize), start_roots: BTreeSet<String>, pub posture_seen: PostureSeen,
}

Fields§

§fake: Fake§core: Option<Core<Fake, MemStore>>§posture: Posture

The posture set_setting posture chose; kept across daemon restarts.

§boots: u64

Reboots so far: the boot id the daemon and watchdog see.

§fresh_boot: bool§daemon_pid: u32§held: bool

The daemon is killed and must not be restarted (catalog hold_down).

§crash: Option<CrashPoint>§start: Timestamp§responses: Vec<Response>§notices: Vec<String>§base: GenerationId

Generation ids for the catalog’s symbolic names.

§candidate: Option<GenerationId>§log: Vec<LogRecord>

Executor log records (I7) from every daemon instance.

§seen_status: BTreeMap<UnitId, BTreeSet<String>>

Every status each unit showed, by tick.

§seen_incidents: BTreeMap<IncidentId, Incident>

Every incident ever opened: (target, kind, first seen, last state, regressions, budget).

§first_incident_at: BTreeMap<UnitId, Timestamp>§pre_status: BTreeMap<UnitId, String>

Statuses just before the first step (for others_unchanged).

§touched: BTreeSet<UnitId>

Units the entry’s own steps act on (exempt from others_unchanged).

§history: Vec<Entry>

Journal entries saved before a compaction discards them, and whether one happened.

§compacted: bool§torn_seen: bool§held_tokens: Vec<Hash>

Approvals issued and held back (approve_pending with hold_token).

§timeline: BTreeMap<UnitId, Vec<(Timestamp, String)>>§foreground_steps: Vec<(Timestamp, String, bool)>

Each foreground step: when, which session, on or off.

§start_probe_defs: String§start_work: (usize, usize)

Stages and builds when the entry’s steps began.

§start_roots: BTreeSet<String>§posture_seen: PostureSeen

planariad’s side of the failure posture (§12d); see PostureSeen.

Implementations§

Source§

impl Sim

Source

pub fn new() -> Sim

Source

pub fn begin(&mut self)

The run proper starts now: what the machine looks like before the first step.

Source

fn build_roots(&self) -> BTreeSet<String>

Source

fn probe_defs(&mut self) -> String

The probe definitions the daemon evaluates, per unit.

Source

fn save_segment(&mut self)

Save the journal’s current segment before something discards it.

Source

pub fn now(&self) -> Timestamp

Source

pub fn ledger(&self) -> Ledger

Source

fn harvest(&mut self)

Source

pub fn evidence(&mut self) -> Evidence

Everything the judge reads (check.rs).

Source

pub fn statuses(&mut self) -> BTreeMap<UnitId, String>

The current status of every unit, by name.

Source

fn observe(&mut self) -> (SystemState, UnitDefs)

Source

fn record_status(&mut self)

Record what the daemon saw at the start of the last tick.

Source

fn watchdog(&mut self)

The watchdog’s 10 s pass.

Source

pub fn tick(&mut self)

Source

fn boot_id(&self) -> Hash

Source

fn kill_daemon(&mut self)

Source

fn integrity(&mut self, why: String)

planariad stopped with status 78: posture.nix routes it to Integrity.

Source

fn start_daemon(&mut self)

Source

fn request(&mut self, actor: &str, req: Request) -> Result<(), Unsupported>

Send a request as actor; a crash point set by a later kill_process fires inside it.

Source

fn request_peer(&mut self, p: Peer, req: Request) -> Result<(), Unsupported>

Source

fn track_candidate(&mut self)

Source

fn until(&mut self, limit: Millis, pred: impl FnMut(&mut Sim) -> bool)

Run until pred holds or limit passes.

Source

fn journal_reached(&self, state: &str) -> bool

Source

pub fn arm( &mut self, steps: &[&T], ) -> (BTreeSet<usize>, Option<(usize, CrashPoint)>)

Pre-scan the steps. Transactions run synchronously here, so a step timed to a journal state (when = { journal = X }) is armed before the transaction it refers to: a planariad kill becomes a crash point on the last transaction before it; the other faults become hooks in the fake machine. Returns the indices of steps consumed this way, and the index of the step the crash point belongs to.

Source

pub fn set_crash(&mut self, p: Option<CrashPoint>)

Source

pub fn step(&mut self, s: &T) -> Result<(), Unsupported>

Source

fn knob( &mut self, u: &UnitId, knob: &str, v: Option<&T>, ) -> Result<(), Unsupported>

Source

fn cli(&self, argv: &[String]) -> Result<Request, Unsupported>

Source

fn transition(&mut self, t: &str, s: &T, actor: &str) -> Result<(), Unsupported>

Source

fn direct(&mut self, actor: &str, t: Transition) -> Result<(), Unsupported>

Submit through the executor directly, for transitions the CLI doesn’t expose.

Source

pub fn run_window(&mut self, window: Millis)

Run ticks for the rest of the window, restarting the daemon unless held down.

Auto Trait Implementations§

§

impl Freeze for Sim

§

impl !RefUnwindSafe for Sim

§

impl Send for Sim

§

impl Sync for Sim

§

impl Unpin for Sim

§

impl UnsafeUnpin for Sim

§

impl !UnwindSafe for Sim

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.