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: PostureThe posture set_setting posture chose; kept across daemon restarts.
boots: u64Reboots so far: the boot id the daemon and watchdog see.
fresh_boot: bool§daemon_pid: u32§held: boolThe daemon is killed and must not be restarted (catalog hold_down).
crash: Option<CrashPoint>§start: Timestamp§responses: Vec<Response>§notices: Vec<String>§base: GenerationIdGeneration 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: PostureSeenplanariad’s side of the failure posture (§12d); see PostureSeen.
Implementations§
Source§impl Sim
impl Sim
pub fn new() -> Sim
Sourcepub fn begin(&mut self)
pub fn begin(&mut self)
The run proper starts now: what the machine looks like before the first step.
fn build_roots(&self) -> BTreeSet<String>
Sourcefn probe_defs(&mut self) -> String
fn probe_defs(&mut self) -> String
The probe definitions the daemon evaluates, per unit.
Sourcefn save_segment(&mut self)
fn save_segment(&mut self)
Save the journal’s current segment before something discards it.
pub fn now(&self) -> Timestamp
pub fn ledger(&self) -> Ledger
fn harvest(&mut self)
Sourcepub fn statuses(&mut self) -> BTreeMap<UnitId, String>
pub fn statuses(&mut self) -> BTreeMap<UnitId, String>
The current status of every unit, by name.
fn observe(&mut self) -> (SystemState, UnitDefs)
Sourcefn record_status(&mut self)
fn record_status(&mut self)
Record what the daemon saw at the start of the last tick.
pub fn tick(&mut self)
fn boot_id(&self) -> Hash
fn kill_daemon(&mut self)
Sourcefn integrity(&mut self, why: String)
fn integrity(&mut self, why: String)
planariad stopped with status 78: posture.nix routes it to Integrity.
fn start_daemon(&mut self)
Sourcefn request(&mut self, actor: &str, req: Request) -> Result<(), Unsupported>
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.
fn request_peer(&mut self, p: Peer, req: Request) -> Result<(), Unsupported>
fn track_candidate(&mut self)
Sourcefn until(&mut self, limit: Millis, pred: impl FnMut(&mut Sim) -> bool)
fn until(&mut self, limit: Millis, pred: impl FnMut(&mut Sim) -> bool)
Run until pred holds or limit passes.
fn journal_reached(&self, state: &str) -> bool
Sourcepub fn arm(
&mut self,
steps: &[&T],
) -> (BTreeSet<usize>, Option<(usize, CrashPoint)>)
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.
pub fn set_crash(&mut self, p: Option<CrashPoint>)
pub fn step(&mut self, s: &T) -> Result<(), Unsupported>
fn knob( &mut self, u: &UnitId, knob: &str, v: Option<&T>, ) -> Result<(), Unsupported>
fn cli(&self, argv: &[String]) -> Result<Request, Unsupported>
fn transition(&mut self, t: &str, s: &T, actor: &str) -> Result<(), Unsupported>
Sourcefn direct(&mut self, actor: &str, t: Transition) -> Result<(), Unsupported>
fn direct(&mut self, actor: &str, t: Transition) -> Result<(), Unsupported>
Submit through the executor directly, for transitions the CLI doesn’t expose.
Sourcepub fn run_window(&mut self, window: Millis)
pub fn run_window(&mut self, window: Millis)
Run ticks for the rest of the window, restarting the daemon unless held down.