pub struct Clock { /* private fields */ }Expand description
The next due time for every scheduled pipeline.
Implementations§
Source§impl Clock
impl Clock
Sourcepub fn new(config: &Config, now: Timestamp) -> Self
pub fn new(config: &Config, now: Timestamp) -> Self
Works out when each scheduled pipeline is first due, starting from now.
Nothing fires at startup. A Tower restarting is not a reason to run every hourly job immediately, and a factory that fired everything on launch would make restarts expensive enough to avoid — which is the opposite of what a supervisor wants.
Sourcepub fn tick(
&self,
config: &Config,
now: Timestamp,
working: impl Fn(&PipelineName) -> bool,
) -> Due
pub fn tick( &self, config: &Config, now: Timestamp, working: impl Fn(&PipelineName) -> bool, ) -> Due
Pipelines due at now, advancing each past this firing.
working answers whether a pipeline’s previous wave is still going. It is asked only for
pipelines that are actually due, so the caller does not pay to look up the rest.
Sourcepub fn next_due(&self, pipeline: &PipelineName) -> Option<Timestamp>
pub fn next_due(&self, pipeline: &PipelineName) -> Option<Timestamp>
When a pipeline is next due, for reporting.
Sourcepub fn until_next(&self, now: Timestamp) -> Option<Duration>
pub fn until_next(&self, now: Timestamp) -> Option<Duration>
How long to wait before the soonest pipeline is due.
None when nothing is scheduled, which is the difference between a Tower that should sleep
until a clock says otherwise and one that has no clock to wait for.