Skip to main content

Backend

Trait Backend 

Source
pub trait Backend:
    Send
    + Sync
    + 'static {
    type Error: Error + Send + Sync + 'static;

Show 20 methods // Required methods fn add_job_types( &self, job_types: &[JobType], ) -> impl Future<Output = Result<(), Self::Error>> + Send; fn list_job_types( &self, ) -> impl Future<Output = Result<Vec<JobType>, Self::Error>> + Send; fn add_jobs( &self, jobs: &[NewJob], if_not_exists: Option<JobFilters>, ) -> impl Future<Output = Result<Vec<JobId>, Self::Error>> + Send; fn list_jobs( &self, filters: JobFilters, order_by: Option<JobOrderBy>, page_size: u32, page_token: Option<NextPageToken>, ) -> impl Future<Output = Result<(Vec<JobDetails>, Option<NextPageToken>), Self::Error>> + Send; fn count_jobs( &self, filters: JobFilters, ) -> impl Future<Output = Result<u64, Self::Error>> + Send; fn cancel_jobs( &self, filters: JobFilters, ) -> impl Future<Output = Result<Vec<CancelledJob>, Self::Error>> + Send; fn add_schedules( &self, schedules: &[ScheduleDefinition], if_not_exists: Option<ScheduleFilters>, ) -> impl Future<Output = Result<Vec<ScheduleId>, Self::Error>> + Send; fn list_schedules( &self, filters: ScheduleFilters, order_by: Option<ScheduleOrderBy>, page_size: u32, page_token: Option<NextPageToken>, ) -> impl Future<Output = Result<(Vec<ScheduleDetails>, Option<NextPageToken>), Self::Error>> + Send; fn count_schedules( &self, filters: ScheduleFilters, ) -> impl Future<Output = Result<u64, Self::Error>> + Send; fn stop_schedules( &self, filters: ScheduleFilters, ) -> impl Future<Output = Result<Vec<StoppedSchedule>, Self::Error>> + Send; fn ready_executions( &self, ) -> impl Stream<Item = Result<Vec<ReadyExecution>, Self::Error>> + Send; fn wait_for_ready_executions( &self, ignore: &[ExecutionId], ) -> impl Future<Output = Result<(), Self::Error>> + Send; fn in_progress_executions( &self, ) -> impl Stream<Item = Result<Vec<InProgressExecution>, Self::Error>> + Send; fn executions_started( &self, executions: &[StartedExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send; fn executions_succeeded( &self, executions: &[SucceededExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send; fn executions_failed( &self, executions: &[FailedExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send; fn executions_retried( &self, executions: &[FailedExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send; fn pending_schedules( &self, ) -> impl Stream<Item = Result<Vec<PendingSchedule>, Self::Error>> + Send; fn wait_for_pending_schedules( &self, ) -> impl Future<Output = Result<(), Self::Error>> + Send; fn delete_history( &self, before: SystemTime, ) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description

Backend implementation for the Ora server.

A backend is responsible for all storage operations as well as timing of executions.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type for backend operations.

Required Methods§

Source

fn add_job_types( &self, job_types: &[JobType], ) -> impl Future<Output = Result<(), Self::Error>> + Send

Add or update job types.

Source

fn list_job_types( &self, ) -> impl Future<Output = Result<Vec<JobType>, Self::Error>> + Send

List all job types.

Source

fn add_jobs( &self, jobs: &[NewJob], if_not_exists: Option<JobFilters>, ) -> impl Future<Output = Result<Vec<JobId>, Self::Error>> + Send

Add new jobs and return their IDs in the same order.

For each new job an execution must also be created.

If if_not_exists is provided and any jobs exist matching the given filters, no new jobs must be added and an empty list must be returned.

Source

fn list_jobs( &self, filters: JobFilters, order_by: Option<JobOrderBy>, page_size: u32, page_token: Option<NextPageToken>, ) -> impl Future<Output = Result<(Vec<JobDetails>, Option<NextPageToken>), Self::Error>> + Send

List jobs matching the given filters.

Source

fn count_jobs( &self, filters: JobFilters, ) -> impl Future<Output = Result<u64, Self::Error>> + Send

Count the jobs matching the given filters.

Source

fn cancel_jobs( &self, filters: JobFilters, ) -> impl Future<Output = Result<Vec<CancelledJob>, Self::Error>> + Send

Cancel the jobs matching the given filters, returning the cancelled jobs.

Source

fn add_schedules( &self, schedules: &[ScheduleDefinition], if_not_exists: Option<ScheduleFilters>, ) -> impl Future<Output = Result<Vec<ScheduleId>, Self::Error>> + Send

Add new schedules and return their IDs in the same order.

If if_not_exists is provided and any schedules exist matching the given filters, no new schedules must be added and an empty list must be returned.

Source

fn list_schedules( &self, filters: ScheduleFilters, order_by: Option<ScheduleOrderBy>, page_size: u32, page_token: Option<NextPageToken>, ) -> impl Future<Output = Result<(Vec<ScheduleDetails>, Option<NextPageToken>), Self::Error>> + Send

List schedules matching the given filters.

Source

fn count_schedules( &self, filters: ScheduleFilters, ) -> impl Future<Output = Result<u64, Self::Error>> + Send

Count the schedules matching the given filters.

Source

fn stop_schedules( &self, filters: ScheduleFilters, ) -> impl Future<Output = Result<Vec<StoppedSchedule>, Self::Error>> + Send

Stop the schedules matching the given filters, returning the IDs of the stopped schedules.

Source

fn ready_executions( &self, ) -> impl Stream<Item = Result<Vec<ReadyExecution>, Self::Error>> + Send

Return ready executions.

The executions must be ordered by their ID.

The batch size of ready executions returned by the stream is backend-dependent.

Source

fn wait_for_ready_executions( &self, ignore: &[ExecutionId], ) -> impl Future<Output = Result<(), Self::Error>> + Send

Wait for executions to be ready.

This function should ignore the provided execution IDs.

Source

fn in_progress_executions( &self, ) -> impl Stream<Item = Result<Vec<InProgressExecution>, Self::Error>> + Send

Return a stream of in-progress executions.

These are executions that have been started by executors but have not yet completed, failed, or been cancelled.

Source

fn executions_started( &self, executions: &[StartedExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send

The given executions have started.

The backend must update the execution records accordingly.

Source

fn executions_succeeded( &self, executions: &[SucceededExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send

The given executions have successfully completed.

Source

fn executions_failed( &self, executions: &[FailedExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send

The given executions have failed.

Source

fn executions_retried( &self, executions: &[FailedExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send

The given executions have failed but need to be retried.

For each job, a new execution must be created.

Source

fn pending_schedules( &self, ) -> impl Stream<Item = Result<Vec<PendingSchedule>, Self::Error>> + Send

Return a stream of active schedules that do not have an active job.

Source

fn wait_for_pending_schedules( &self, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Wait for pending schedules to be available.

Source

fn delete_history( &self, before: SystemTime, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Delete historical data for inactive jobs and schedules.

The following should be deleted:

  • Jobs with executions that finished before the given time.
  • Schedules that were stopped before the given time.
  • Delete job types that are not referenced by any jobs.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§