1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Schedule read-back value (ADR-019 §3).
//!
//! `#[non_exhaustive]` per ADR-017 §3 — consumers read but never
//! construct.
use crate::opts::ScheduleOpts;
/// The `schedule()` read-back value (upsert by name).
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub struct Schedule {
/// The schedule name (shared namespace — validated at the entry
/// point with the reserved prefix rejected).
pub name: String,
/// The v1 spec grammar: `@every <n><unit>` only (`s|m|h|d`).
pub spec: String,
/// The target queue name fired jobs enqueue into.
pub queue: String,
/// The schedule's opts, applied over the target queue's derived
/// engine defaults at each boundary fire (ADR-020 §3).
pub opts: ScheduleOpts,
}
impl Schedule {
/// Engine-construction-only constructor taking the full field set.
///
/// # Contract posture
///
/// Not consumer API and not part of the contract surface: engines
/// (in-repo, lockstep-updated with core) use it to build
/// [`Schedule`] values from row data, since `#[non_exhaustive]`
/// (ADR-017 §3) bans struct-literal construction downstream. Not
/// covered by ADR-017's semver-minor field-addition promise — a
/// `Schedule` field addition changes this signature, which is an
/// engine breaking change under a core change and a lockstep-duty
/// event (ADR-017 §5). Hidden from consumer-facing docs.
#[doc(hidden)]
pub fn new(name: String, spec: String, queue: String, opts: ScheduleOpts) -> Self {
Self {
name,
spec,
queue,
opts,
}
}
}