Skip to main content

Host

Trait Host 

Source
pub trait Host {
    type Gen: GenerationBackend;
    type Inv: InventoryBackend;

    // Required methods
    fn generations(&self) -> &Self::Gen;
    fn inventory(&self) -> &Self::Inv;
    fn execute_runtime(&self, t: &Transition, op: &OpId) -> Outcome;
    fn reobserve(&self, txn: &Transaction) -> Outcome;
    fn check(&self, txn: &Transaction, phase: CheckPhase) -> Verdict;
    fn release_gc_root(&self, path: &str) -> bool;
    fn now(&self) -> Timestamp;
    fn boot_now(&self) -> Timestamp;
    fn sleep(&self, d: Millis);
    fn kill_worker(&self, pid: u32) -> bool;
    fn pid_alive(&self, pid: u32) -> bool;

    // Provided method
    fn floor_fixes(
        &self,
        _txn: &Transaction,
        _floor: Option<GenerationId>,
    ) -> Result<Vec<String>, Outcome> { ... }
}
Expand description

Everything the kernel needs from below. One generic parameter (no dyn, §6).

Required Associated Types§

Required Methods§

Source

fn generations(&self) -> &Self::Gen

Source

fn inventory(&self) -> &Self::Inv

Source

fn execute_runtime(&self, t: &Transition, op: &OpId) -> Outcome

Perform a ReobserveOnly transition’s backend effect (restart, stop, runtime option, GC). Override bookkeeping is the kernel’s job, not this.

Source

fn reobserve(&self, txn: &Transaction) -> Outcome

Settle, then observe and compare against the expectation; the outcome is recorded, never acted on (§12 step 7, UnitOp).

Source

fn check(&self, txn: &Transaction, phase: CheckPhase) -> Verdict

Run the applicable Readiness probes from the candidate’s UnitDefs and the installed core, plus the expectation and executor-owned requirements.

Source

fn release_gc_root(&self, path: &str) -> bool

Remove a GC root (I3). Returns false if it could not be removed.

Source

fn now(&self) -> Timestamp

Source

fn boot_now(&self) -> Timestamp

The boot clock (CLOCK_BOOTTIME): leases, deadlines and waits (§12h).

Source

fn sleep(&self, d: Millis)

Source

fn kill_worker(&self, pid: u32) -> bool

SIGTERM then SIGKILL the process group via pidfd; true once confirmed dead.

Source

fn pid_alive(&self, pid: u32) -> bool

Provided Methods§

Source

fn floor_fixes( &self, _txn: &Transaction, _floor: Option<GenerationId>, ) -> Result<Vec<String>, Outcome>

§12e, I25: the security fixes txn’s candidate brings, absent from the floor generation and every generation between it and the candidate (every earlier one, with no floor). Part of the commit: an error here means the transaction does not commit yet.

Implementors§