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§
Required Methods§
Sourcefn add_job_types(
&self,
job_types: &[JobType],
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn add_job_types( &self, job_types: &[JobType], ) -> impl Future<Output = Result<(), Self::Error>> + Send
Add or update job types.
Sourcefn list_job_types(
&self,
) -> impl Future<Output = Result<Vec<JobType>, Self::Error>> + Send
fn list_job_types( &self, ) -> impl Future<Output = Result<Vec<JobType>, Self::Error>> + Send
List all job types.
Sourcefn add_jobs(
&self,
jobs: &[NewJob],
if_not_exists: Option<JobFilters>,
) -> impl Future<Output = Result<Vec<JobId>, Self::Error>> + Send
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.
Sourcefn 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 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.
Sourcefn count_jobs(
&self,
filters: JobFilters,
) -> impl Future<Output = Result<u64, Self::Error>> + Send
fn count_jobs( &self, filters: JobFilters, ) -> impl Future<Output = Result<u64, Self::Error>> + Send
Count the jobs matching the given filters.
Sourcefn cancel_jobs(
&self,
filters: JobFilters,
) -> impl Future<Output = Result<Vec<CancelledJob>, Self::Error>> + Send
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.
Sourcefn add_schedules(
&self,
schedules: &[ScheduleDefinition],
if_not_exists: Option<ScheduleFilters>,
) -> impl Future<Output = Result<Vec<ScheduleId>, Self::Error>> + Send
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.
Sourcefn 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 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.
Sourcefn count_schedules(
&self,
filters: ScheduleFilters,
) -> impl Future<Output = Result<u64, Self::Error>> + Send
fn count_schedules( &self, filters: ScheduleFilters, ) -> impl Future<Output = Result<u64, Self::Error>> + Send
Count the schedules matching the given filters.
Sourcefn stop_schedules(
&self,
filters: ScheduleFilters,
) -> impl Future<Output = Result<Vec<StoppedSchedule>, Self::Error>> + Send
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.
Sourcefn ready_executions(
&self,
) -> impl Stream<Item = Result<Vec<ReadyExecution>, Self::Error>> + Send
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.
Sourcefn wait_for_ready_executions(
&self,
ignore: &[ExecutionId],
) -> impl Future<Output = Result<(), Self::Error>> + Send
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.
Sourcefn in_progress_executions(
&self,
) -> impl Stream<Item = Result<Vec<InProgressExecution>, Self::Error>> + Send
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.
Sourcefn executions_started(
&self,
executions: &[StartedExecution],
) -> impl Future<Output = Result<(), Self::Error>> + Send
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.
Sourcefn executions_succeeded(
&self,
executions: &[SucceededExecution],
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn executions_succeeded( &self, executions: &[SucceededExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send
The given executions have successfully completed.
Sourcefn executions_failed(
&self,
executions: &[FailedExecution],
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn executions_failed( &self, executions: &[FailedExecution], ) -> impl Future<Output = Result<(), Self::Error>> + Send
The given executions have failed.
Sourcefn executions_retried(
&self,
executions: &[FailedExecution],
) -> impl Future<Output = Result<(), Self::Error>> + Send
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.
Sourcefn pending_schedules(
&self,
) -> impl Stream<Item = Result<Vec<PendingSchedule>, Self::Error>> + Send
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.
Sourcefn wait_for_pending_schedules(
&self,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn wait_for_pending_schedules( &self, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Wait for pending schedules to be available.
Sourcefn delete_history(
&self,
before: SystemTime,
) -> impl Future<Output = Result<(), Self::Error>> + Send
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.