pub struct ScheduleModule { /* private fields */ }Expand description
schedule.* over the session’s values.
Implementations§
Source§impl ScheduleModule
impl ScheduleModule
pub fn new( store: Box<dyn KeyedDocuments>, session_id: &str, clock: Arc<dyn TickClock>, listener: Option<Listener>, ) -> Self
Sourcepub fn with_github(self, github: GitHub) -> Self
pub fn with_github(self, github: GitHub) -> Self
Select the argv runner (a scripted executable in isolated tests).
pub fn now(&self) -> i64
Sourcepub fn all(&self) -> Result<Vec<Schedule>, String>
pub fn all(&self) -> Result<Vec<Schedule>, String>
This session’s schedules, in the order they were created (values copied from another session are not).
Sourcepub fn entries(&self) -> Result<Vec<Value>, String>
pub fn entries(&self) -> Result<Vec<Value>, String>
The active schedules as the server keeps them.
Sourcepub fn put(&self, schedule: &Schedule) -> Result<(), String>
pub fn put(&self, schedule: &Schedule) -> Result<(), String>
Write schedule as it is (a schedule the server keeps itself, such as the durable instance’s dream).
Sourcepub fn cancel(&self, name_or_id: &str) -> Result<Schedule, String>
pub fn cancel(&self, name_or_id: &str) -> Result<Schedule, String>
Cancel by id, else active name, else latest name (including a final run already queued).
Sourcepub fn fire(&self, id: &str, due: i64) -> Result<Option<Fired>, String>
pub fn fire(&self, id: &str, due: i64) -> Result<Option<Fired>, String>
Run schedule id for its slot due: records the run (and the next slot after now) and returns the prompt
message. None: nothing to run (not active, not due yet, or due is not its next slot: a duplicate fire).
Sourcepub fn fire_with(
&self,
id: &str,
due: i64,
deliver: &mut dyn FnMut(&Value) -> Result<(), String>,
) -> Result<Option<Fired>, String>
pub fn fire_with( &self, id: &str, due: i64, deliver: &mut dyn FnMut(&Value) -> Result<(), String>, ) -> Result<Option<Fired>, String>
ScheduleModule::fire that counts the run only once deliver took its prompt message (started or queued
a run): a delivery that fails writes nothing (the slot stays due, an at schedule stays active) and its
error is returned.