pub struct AdminClient<C = Channel> { /* private fields */ }
Expand description
A high-level client for interacting with the Ora server admin endpoints.
Implementations§
Source§impl<C> AdminClient<C>where
C: GrpcService<BoxBody> + Clone + Send + Sync + 'static,
<C as GrpcService<BoxBody>>::Future: Send,
C::Error: Into<StdError>,
C::ResponseBody: Body<Data = Bytes> + Send + 'static,
<C::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<C> AdminClient<C>where
C: GrpcService<BoxBody> + Clone + Send + Sync + 'static,
<C as GrpcService<BoxBody>>::Future: Send,
C::Error: Into<StdError>,
C::ResponseBody: Body<Data = Bytes> + Send + 'static,
<C::ResponseBody as Body>::Error: Into<StdError> + Send,
Sourcepub fn new(client: AdminServiceClient<C>) -> Self
pub fn new(client: AdminServiceClient<C>) -> Self
Create a new admin client from a gRPC client.
Sourcepub async fn add_job<J>(
&self,
definition: TypedJobDefinition<J>,
) -> Result<JobHandle<J, C>, AdminClientError>
pub async fn add_job<J>( &self, definition: TypedJobDefinition<J>, ) -> Result<JobHandle<J, C>, AdminClientError>
Add a new job to be executed.
Sourcepub async fn add_job_persistent<J>(
&self,
definition: TypedJobDefinition<J>,
) -> Result<PersistentJob<J, C>, AdminClientError>
pub async fn add_job_persistent<J>( &self, definition: TypedJobDefinition<J>, ) -> Result<PersistentJob<J, C>, AdminClientError>
Add a new job to be executed.
If an active job with the same job type and labels already exists, it will be returned instead.
Sourcepub async fn add_jobs<J>(
&self,
definitions: impl IntoIterator<Item = TypedJobDefinition<J>>,
) -> Result<Vec<JobHandle<J, C>>, AdminClientError>
pub async fn add_jobs<J>( &self, definitions: impl IntoIterator<Item = TypedJobDefinition<J>>, ) -> Result<Vec<JobHandle<J, C>>, AdminClientError>
Add multiple new jobs to be executed.
Sourcepub fn job(&self, job_id: Uuid) -> JobHandle<(), C>
pub fn job(&self, job_id: Uuid) -> JobHandle<(), C>
Create a job handle for a specific job.
Note that this method does not check if the job exists.
Sourcepub fn jobs_of_type<J>(
&self,
filter: JobFilter,
order_by: JobOrder,
) -> impl Stream<Item = Result<JobHandle<J, C>, AdminClientError>> + Send + Unpin + 'staticwhere
J: JobType,
pub fn jobs_of_type<J>(
&self,
filter: JobFilter,
order_by: JobOrder,
) -> impl Stream<Item = Result<JobHandle<J, C>, AdminClientError>> + Send + Unpin + 'staticwhere
J: JobType,
Retrieve a list of jobs of a specific type with a specific filter and order.
The returned job handles will have their details pre-fetched.
Sourcepub fn jobs(
&self,
filter: JobFilter,
order_by: JobOrder,
) -> impl Stream<Item = Result<JobHandle<(), C>, AdminClientError>> + Send + Unpin + 'static
pub fn jobs( &self, filter: JobFilter, order_by: JobOrder, ) -> impl Stream<Item = Result<JobHandle<(), C>, AdminClientError>> + Send + Unpin + 'static
Retrieve a list of jobs with a specific filter and order.
The returned job handles will have their details pre-fetched.
Sourcepub async fn job_count(
&self,
filter: JobFilter,
) -> Result<u64, AdminClientError>
pub async fn job_count( &self, filter: JobFilter, ) -> Result<u64, AdminClientError>
Count the number of jobs with a specific filter.
Sourcepub async fn job_count_of_type<J>(
&self,
filter: JobFilter,
) -> Result<u64, AdminClientError>where
J: JobType,
pub async fn job_count_of_type<J>(
&self,
filter: JobFilter,
) -> Result<u64, AdminClientError>where
J: JobType,
Count the number of jobs of a specific type with a specific filter.
Sourcepub async fn cancel_jobs(
&self,
filter: JobFilter,
) -> Result<Vec<JobHandle<(), C>>, AdminClientError>
pub async fn cancel_jobs( &self, filter: JobFilter, ) -> Result<Vec<JobHandle<(), C>>, AdminClientError>
Cancel jobs with a specific filter.
Returns handles to jobs that were successfully cancelled.
Sourcepub async fn delete_inactive_jobs(
&self,
filter: JobFilter,
) -> Result<Vec<Uuid>, AdminClientError>
pub async fn delete_inactive_jobs( &self, filter: JobFilter, ) -> Result<Vec<Uuid>, AdminClientError>
Delete inactive jobs and associated with a specific filter, returning the deleted job IDs.
Sourcepub async fn add_schedule(
&self,
schedule: ScheduleDefinition,
) -> Result<ScheduleHandle<C>, AdminClientError>
pub async fn add_schedule( &self, schedule: ScheduleDefinition, ) -> Result<ScheduleHandle<C>, AdminClientError>
Add a new schedule.
Sourcepub async fn add_schedule_persistent(
&self,
schedule: ScheduleDefinition,
) -> Result<PersistentSchedule<C>, AdminClientError>
pub async fn add_schedule_persistent( &self, schedule: ScheduleDefinition, ) -> Result<PersistentSchedule<C>, AdminClientError>
Add a new schedule.
If an active schedule with the same job type and labels already exists, it will be returned instead.
Sourcepub async fn add_schedules(
&self,
schedules: impl IntoIterator<Item = ScheduleDefinition>,
) -> Result<Vec<ScheduleHandle<C>>, AdminClientError>
pub async fn add_schedules( &self, schedules: impl IntoIterator<Item = ScheduleDefinition>, ) -> Result<Vec<ScheduleHandle<C>>, AdminClientError>
Add multiple new schedules.
Returns handles to the created schedules.
Sourcepub fn schedule(&self, schedule_id: Uuid) -> ScheduleHandle<C>
pub fn schedule(&self, schedule_id: Uuid) -> ScheduleHandle<C>
Create a new schedule handle for a specific schedule.
Note that this method does not check if the schedule exists.
Sourcepub fn schedules(
&self,
filter: ScheduleFilter,
order: ScheduleOrder,
) -> impl Stream<Item = Result<ScheduleHandle<C>, AdminClientError>> + Send + Unpin + 'static
pub fn schedules( &self, filter: ScheduleFilter, order: ScheduleOrder, ) -> impl Stream<Item = Result<ScheduleHandle<C>, AdminClientError>> + Send + Unpin + 'static
Retrieve a list of schedules with a specific filter and order.
The returned schedule handles will have their details pre-fetched.
Sourcepub async fn schedule_count(
&self,
filter: ScheduleFilter,
) -> Result<u64, AdminClientError>
pub async fn schedule_count( &self, filter: ScheduleFilter, ) -> Result<u64, AdminClientError>
Return the number of schedules that match a specific filter.
Sourcepub async fn cancel_schedules(
&self,
filter: ScheduleFilter,
cancel_jobs: bool,
) -> Result<ScheduleCancellationResult<C>, AdminClientError>
pub async fn cancel_schedules( &self, filter: ScheduleFilter, cancel_jobs: bool, ) -> Result<ScheduleCancellationResult<C>, AdminClientError>
Cancel schedules with a specific filter, optionally cancelling the jobs associated with them.
Trait Implementations§
Source§impl<C: Clone> Clone for AdminClient<C>
impl<C: Clone> Clone for AdminClient<C>
Source§fn clone(&self) -> AdminClient<C>
fn clone(&self) -> AdminClient<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<C: Debug> Debug for AdminClient<C>
impl<C: Debug> Debug for AdminClient<C>
Source§impl From<AdminServiceClient<Channel>> for AdminClient
impl From<AdminServiceClient<Channel>> for AdminClient
Source§fn from(client: AdminServiceClient<Channel>) -> Self
fn from(client: AdminServiceClient<Channel>) -> Self
Auto Trait Implementations§
impl<C = Channel> !Freeze for AdminClient<C>
impl<C> RefUnwindSafe for AdminClient<C>where
C: RefUnwindSafe,
impl<C> Send for AdminClient<C>where
C: Send,
impl<C> Sync for AdminClient<C>where
C: Sync,
impl<C> Unpin for AdminClient<C>where
C: Unpin,
impl<C> UnwindSafe for AdminClient<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<W> IntoExecutionHandler for W
impl<W> IntoExecutionHandler for W
Source§fn handler<J>(self) -> Arc<dyn ExecutionHandlerRaw + Send + Sync>where
Self: ExecutionHandler<J>,
J: JobType,
fn handler<J>(self) -> Arc<dyn ExecutionHandlerRaw + Send + Sync>where
Self: ExecutionHandler<J>,
J: JobType,
self
into a [RawHandler
] that can be registered
in workers.Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request