pub trait SchedulerControl:
Send
+ Sync
+ Debug {
// Required methods
fn add_scheduled_job(&self, id: QName, schedule: Schedule);
fn cancel(&self, id: &QName) -> bool;
fn list(&self) -> Vec<SchedulerJobRecord>;
// Provided methods
fn submit_cypher(&self, _cypher: &str) -> Result<(), FnError> { ... }
fn flush_checkpoint(&self) -> Result<(), FnError> { ... }
}Expand description
Trait-object handle to a scheduler, for cross-crate callers that
can’t depend on the concrete host-side SchedulerHost type.
The built-in uni.periodic.* procedures hold an Arc<dyn SchedulerControl> so they can register / cancel / list jobs
without depending on uni-db. The host crate (uni-db) implements
this on its SchedulerHost and passes it down at registration
time.
Required Methods§
Sourcefn add_scheduled_job(&self, id: QName, schedule: Schedule)
fn add_scheduled_job(&self, id: QName, schedule: Schedule)
Register a job to fire on schedule.
Sourcefn list(&self) -> Vec<SchedulerJobRecord>
fn list(&self) -> Vec<SchedulerJobRecord>
Snapshot of every known job.
Provided Methods§
Sourcefn submit_cypher(&self, _cypher: &str) -> Result<(), FnError>
fn submit_cypher(&self, _cypher: &str) -> Result<(), FnError>
Submit an inline write-mode Cypher body for synchronous
execution. The default impl returns an error so simple
scheduler primitives (without a host) can still satisfy the
trait shape; the uni-db::scheduler::SchedulerHost override
dispatches through its crate::traits::background::JobHost.
Used by uni.periodic.submit(...) and as the inner-loop body
of uni.periodic.iterate(...).
§Errors
Returns crate::FnError when the scheduler is not wired to a
Cypher-execution host (default impl) or when the submitted
statement fails.
Sourcefn flush_checkpoint(&self) -> Result<(), FnError>
fn flush_checkpoint(&self) -> Result<(), FnError>
Drive the persistence backend to flush its checkpoint buffer.
Default impl is a no-op so the bare Scheduler (with
MemoryPersistence) and any control that has no durable
backend keep working without an override. The host-side
SchedulerHost override forwards to its
SchedulerPersistence::flush_checkpoint.
§Errors
Returns crate::FnError when the persistence backend reports
a flush failure.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".