pub enum When {
PerPc(PerPolicy),
PerTarget(PerPolicy),
Calendar(CalendarSpec),
On(Vec<OnTrigger>),
}Expand description
#418 Phase 1 — the single “when does this fire” axis.
Replaces the old cron + mode + cooldown trio whose
interactions were implicit (cron doubled as both a real
time-of-day trigger and a reconcile poll period; contradictory
combinations silently no-opped). Two shapes:
- reconcile (
per_pc/per_target) — desired-state: “each pc (or one delegate) should have run this withinevery”. The poll period is system-generated (POLL_CRON, every minute) and no longer the operator’s concern. - calendar (
{ at, days }) — a wall-clock time trigger (#418 Phase 2, replacing the old raw-cron escape hatch). Fires the whole target at the given time, no dedup.at: "09:00"+daysrepeats;at: "2026-06-10 09:00"(a date+time) fires exactly once. Evaluated in the schedule’s top-leveltz.
Variants§
PerPc(PerPolicy)
Fire at each targeted pc: once (kitting — succeed once,
skip forever, forever catching brand-new / re-imaged pcs)
or { every: <humantime> } (patrol — re-arm per pc after
the interval).
PerTarget(PerPolicy)
Fire until any one pc of the target succeeds, then skip
the whole target (once) or re-arm after every. Needs
fleet-wide completion data, so it is backend-only —
runs_on: agent + per_target is rejected by
Schedule::validate.
Calendar(CalendarSpec)
Calendar time trigger: { at: "09:00", days: [mon-fri] }
(repeating) or { at: "2026-06-10 09:00" } (one-shot). Fires
the whole target at that wall-clock time in the schedule’s
tz — no dedup, no cooldown.
On(Vec<OnTrigger>)
#418 OS-native event trigger: when: { on: [startup, logon] }.
Fires when the agent observes the listed OS event(s) rather than
on a clock — there is no cron. runs_on: agent only (the agent
owns the event source); Schedule::validate rejects it on
backend and rejects an empty list. Each event occurrence fires
once, gated by the same freeze / active / constraints.window /
skip_dates checks as the cron path. startup fires once per OS
boot (deduped via the host boot time); a starting_deadline, if
set, limits it to “agent came up within that long after boot”.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for When
impl<'de> Deserialize<'de> for When
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for When
Source§impl JsonSchema for When
impl JsonSchema for When
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for When
Auto Trait Implementations§
impl Freeze for When
impl RefUnwindSafe for When
impl Send for When
impl Sync for When
impl Unpin for When
impl UnsafeUnpin for When
impl UnwindSafe for When
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.