Skip to main content

Schedule

Enum Schedule 

Source
pub enum Schedule {
    Every(Duration),
    Cron(String),
}
Expand description

When a scheduled pipeline fires.

Variants§

§

Every(Duration)

A fixed interval between runs.

§

Cron(String)

A five-field cron expression, evaluated in the Tower’s local time zone.

Implementations§

Source§

impl Schedule

Source

pub const MIN_INTERVAL_SECS: u64 = 60

The shortest interval a schedule may declare.

Every firing is a real, paid CLI invocation, and a schedule runs with nobody watching. A minute is the floor because it is the finest granularity a five-field cron expression can express, so allowing anything shorter would make every and cron disagree about what is possible.

Source

pub fn interval(&self) -> Option<Duration>

Returns the fixed interval, if this schedule is one.

Source

pub fn next_after(&self, now: Timestamp) -> Option<Timestamp>

The first firing strictly after now.

Both forms are computed from the clock rather than from when the last run finished. Adding an interval to a finish time makes the period drift by however long the work took, so an hourly job slowly becomes a ninety-minute one.

Returns None only for a cron expression that never matches — 31 February, say — which parses cleanly and is therefore accepted at load. A pipeline that can never fire is better left silent than made to fire at some arbitrary substitute time.

Source

pub fn min_gap_secs(&self) -> Option<u64>

Returns a lower bound on the gap between firings, in seconds, when one can be established.

For a fixed interval this is exact. For a cron expression it is read off the minute field, and only when that field states the answer unambiguously: * fires every minute and */n every n minutes. Lists and ranges are left alone rather than guessed at, because a wrong lower bound here means a warning that is not true, and a validator that cries wolf is one people stop reading.

Trait Implementations§

Source§

impl Clone for Schedule

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schedule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Schedule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Schedule

Source§

impl PartialEq for Schedule

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Schedule

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V