Skip to main content

WorkerUtilsWithExecutor

Struct WorkerUtilsWithExecutor 

Source
pub struct WorkerUtilsWithExecutor<E> { /* private fields */ }
Expand description

A scoped WorkerUtils facade that routes operations through a caller-provided executor.

Use WorkerUtils::with_executor when job operations must participate in an existing transaction. The caller owns the executor lifecycle and remains responsible for committing or rolling back transactions.

Maintenance operations that manage their own transaction or shared state (cleanup, migrate, and stale-worker sweeps) remain available only on WorkerUtils.

Implementations§

Source§

impl<E> WorkerUtilsWithExecutor<E>
where E: DbExecutorArg,

Source

pub fn into_inner(self) -> WorkerUtils

Returns the configured WorkerUtils, releasing the injected executor.

Source

pub async fn add_job<T>( &mut self, payload: T, spec: JobSpec, ) -> Result<Job, GraphileWorkerError>
where T: TaskHandler,

Adds a job to the queue with type safety.

Source

pub async fn add_raw_job<P>( &mut self, identifier: &str, payload: P, spec: JobSpec, ) -> Result<Job, GraphileWorkerError>
where P: Serialize,

Adds a job to the queue with a raw identifier and payload.

Source

pub async fn add_jobs<T>( &mut self, jobs: &[(T, &JobSpec)], ) -> Result<Vec<Job>, GraphileWorkerError>
where T: TaskHandler + Clone,

Adds multiple jobs of the same type in one database operation.

Source

pub async fn add_raw_jobs( &mut self, jobs: &[RawJobSpec], ) -> Result<Vec<Job>, GraphileWorkerError>

Adds multiple jobs with raw identifiers and payloads in one database operation.

Source

pub async fn add_batch_job<T>( &mut self, payloads: Vec<T>, spec: JobSpec, ) -> Result<Job, GraphileWorkerError>

Adds a batch job to the queue with type safety.

Source

pub async fn remove_job( &mut self, job_key: &str, ) -> Result<(), GraphileWorkerError>

Removes a job from the queue by its job key.

Source

pub async fn complete_jobs( &mut self, ids: &[i64], ) -> Result<Vec<DbJob>, GraphileWorkerError>

Marks multiple jobs as completed.

Source

pub async fn permanently_fail_jobs( &mut self, ids: &[i64], reason: &str, ) -> Result<Vec<DbJob>, GraphileWorkerError>

Marks multiple jobs as permanently failed with a reason.

Source

pub async fn reschedule_jobs( &mut self, ids: &[i64], options: RescheduleJobOptions, ) -> Result<Vec<DbJob>, GraphileWorkerError>

Reschedules multiple jobs with new parameters.

Source

pub async fn list_active_workers( &mut self, sweep_threshold: Duration, ) -> Result<Vec<ActiveWorkerRow>, GraphileWorkerError>

Lists workers registered in the heartbeat table.

Source

pub async fn force_unlock_workers( &mut self, worker_ids: &[&str], ) -> Result<(), GraphileWorkerError>

Force unlocks worker records in the database.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more