Skip to main content

InMemoryJobQueue

Struct InMemoryJobQueue 

Source
pub struct InMemoryJobQueue { /* private fields */ }

Implementations§

Source§

impl InMemoryJobQueue

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Default for InMemoryJobQueue

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl JobQueue for InMemoryJobQueue

Source§

async fn enqueue(&self, job: QueuedJob) -> Result<(), QueueError>

Enqueue a job for execution. Called by the scheduler when dependencies are met.
Source§

async fn claim( &self, worker_id: &str, worker_labels: &[String], lease_ttl: Duration, ) -> Result<Option<(QueuedJob, Lease)>, QueueError>

Atomically claim the next available job matching the worker’s labels. Returns None if no matching job is available.
Source§

async fn renew_lease( &self, lease_id: &str, extend_by: Duration, ) -> Result<(), QueueError>

Renew a lease (heartbeat). Returns error if the lease has already expired.
Source§

async fn complete( &self, lease_id: &str, outputs: HashMap<String, String>, ) -> Result<(), QueueError>

Complete a job successfully. Releases the lease and stores outputs.
Source§

async fn fail( &self, lease_id: &str, error: String, retryable: bool, ) -> Result<(), QueueError>

Fail a job. The queue decides whether to re-enqueue based on RetryPolicy.
Source§

async fn cancel( &self, workflow_id: &str, job_id: &str, ) -> Result<(), QueueError>

Cancel a specific job. If currently claimed, marks it for cancellation.
Source§

async fn cancel_workflow(&self, workflow_id: &str) -> Result<(), QueueError>

Cancel all jobs for a workflow.
Source§

async fn is_cancelled( &self, workflow_id: &str, job_id: &str, ) -> Result<bool, QueueError>

Check if a job has been marked for cancellation (workers poll this).
Source§

async fn reap_expired_leases(&self) -> Result<Vec<JobEvent>, QueueError>

Collect expired leases and emit LeaseExpired events. Called periodically by the server’s monitor task.
Source§

fn subscribe(&self) -> Receiver<JobEvent>

Subscribe to job events for event-driven processing.

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, 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, 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.