Trait ora_api::client::Client

source ·
pub trait Client: Debug + Send + Sync + 'static {
    // Required methods
    fn add_task<'life0, 'async_trait, T>(
        &'life0 self,
        task: TaskDefinition<T>
    ) -> Pin<Box<dyn Future<Output = Result<TaskHandle<T>>> + Send + 'async_trait>>
       where T: Send + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn add_tasks<'life0, 'async_trait, T, I>(
        &'life0 self,
        tasks: I
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskHandle<T>>>> + Send + 'async_trait>>
       where T: Send + 'static + 'async_trait,
             I: IntoIterator<Item = TaskDefinition<T>> + Send + 'async_trait,
             I::IntoIter: ExactSizeIterator + Send,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn task<'life0, 'async_trait, T>(
        &'life0 self,
        task_id: Uuid
    ) -> Pin<Box<dyn Future<Output = Result<TaskHandle<T>>> + Send + 'async_trait>>
       where T: Send + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn tasks<'life0, 'life1, 'async_trait>(
        &'life0 self,
        options: &'life1 Tasks
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskHandle>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn task_count<'life0, 'life1, 'async_trait>(
        &'life0 self,
        options: &'life1 Tasks
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cancel_tasks<'life0, 'life1, 'async_trait>(
        &'life0 self,
        options: &'life1 Tasks
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskHandle>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add_schedule<'life0, 'async_trait>(
        &'life0 self,
        schedule: ScheduleDefinition
    ) -> Pin<Box<dyn Future<Output = Result<ScheduleHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_schedules<'life0, 'async_trait, I>(
        &'life0 self,
        schedules: I
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ScheduleHandle>>> + Send + 'async_trait>>
       where I: IntoIterator<Item = ScheduleDefinition> + Send + 'async_trait,
             I::IntoIter: ExactSizeIterator + Send,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn schedule<'life0, 'async_trait>(
        &'life0 self,
        schedule_id: Uuid
    ) -> Pin<Box<dyn Future<Output = Result<ScheduleHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn schedules<'life0, 'life1, 'async_trait>(
        &'life0 self,
        options: &'life1 Schedules
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ScheduleHandle>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn schedule_count<'life0, 'life1, 'async_trait>(
        &'life0 self,
        options: &'life1 Schedules
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cancel_schedules<'life0, 'life1, 'async_trait>(
        &'life0 self,
        options: &'life1 Schedules
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ScheduleHandle>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A client for interacting with the Ora framework.

This is usually implemented by a store or any interface over a store.

Required Methods§

source

fn add_task<'life0, 'async_trait, T>( &'life0 self, task: TaskDefinition<T> ) -> Pin<Box<dyn Future<Output = Result<TaskHandle<T>>> + Send + 'async_trait>>where T: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Add a new task of the given type.

source

fn add_tasks<'life0, 'async_trait, T, I>( &'life0 self, tasks: I ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskHandle<T>>>> + Send + 'async_trait>>where T: Send + 'static + 'async_trait, I: IntoIterator<Item = TaskDefinition<T>> + Send + 'async_trait, I::IntoIter: ExactSizeIterator + Send, Self: 'async_trait, 'life0: 'async_trait,

Add multiple tasks of a given type.

This is more performant for some implementations than calling add_tasks repeatedly.

source

fn task<'life0, 'async_trait, T>( &'life0 self, task_id: Uuid ) -> Pin<Box<dyn Future<Output = Result<TaskHandle<T>>> + Send + 'async_trait>>where T: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Retrieve a task by its ID.

source

fn tasks<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 Tasks ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskHandle>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve multiple tasks.

The returned task handles are type-erased, individual tasks can be cast via TaskHandle::cast to specific types.

source

fn task_count<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 Tasks ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count current tasks.

source

fn cancel_tasks<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 Tasks ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskHandle>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel all matching tasks and return handles to tasks that were cancelled.

Cancellation is no-op on already finished tasks.

The returned task handles are type-erased.

source

fn add_schedule<'life0, 'async_trait>( &'life0 self, schedule: ScheduleDefinition ) -> Pin<Box<dyn Future<Output = Result<ScheduleHandle>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Add a new schedule.

source

fn add_schedules<'life0, 'async_trait, I>( &'life0 self, schedules: I ) -> Pin<Box<dyn Future<Output = Result<Vec<ScheduleHandle>>> + Send + 'async_trait>>where I: IntoIterator<Item = ScheduleDefinition> + Send + 'async_trait, I::IntoIter: ExactSizeIterator + Send, Self: 'async_trait, 'life0: 'async_trait,

Add multiple schedules.

This is more performant for some implementations than calling add_schedule repeatedly.

source

fn schedule<'life0, 'async_trait>( &'life0 self, schedule_id: Uuid ) -> Pin<Box<dyn Future<Output = Result<ScheduleHandle>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Retrieve a schedule by its ID.

source

fn schedules<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 Schedules ) -> Pin<Box<dyn Future<Output = Result<Vec<ScheduleHandle>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve multiple schedules.

source

fn schedule_count<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 Schedules ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count current schedules.

source

fn cancel_schedules<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 Schedules ) -> Pin<Box<dyn Future<Output = Result<Vec<ScheduleHandle>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel all matching schedules and return handles to schedules that were cancelled.

Cancellation is no-op on inactive schedules.

Implementors§

source§

impl<C> Client for Cwhere C: ClientOperations,