Skip to main content

TaskClaimStore

Trait TaskClaimStore 

Source
pub trait TaskClaimStore: Send + Sync {
    // Required methods
    fn claim_task(
        &self,
        instance_id: &str,
        task_id: &str,
        worker_id: &str,
        ttl: Option<Duration>,
    ) -> impl Future<Output = Result<Option<TaskClaim>, BackendError>> + Send;
    fn release_task_claim(
        &self,
        instance_id: &str,
        task_id: &str,
        worker_id: &str,
    ) -> impl Future<Output = Result<(), BackendError>> + Send;
    fn extend_task_claim(
        &self,
        instance_id: &str,
        task_id: &str,
        worker_id: &str,
        additional_duration: Duration,
    ) -> impl Future<Output = Result<(), BackendError>> + Send;
    fn find_available_tasks(
        &self,
        worker_id: &str,
        limit: usize,
    ) -> impl Future<Output = Result<Vec<AvailableTask>, BackendError>> + Send;
}
Expand description

Task claiming for distributed multi-worker execution.

Only needed when using PooledWorker. Single-process backends (used with CheckpointingRunner) do not need to implement this.

Required Methods§

Source

fn claim_task( &self, instance_id: &str, task_id: &str, worker_id: &str, ttl: Option<Duration>, ) -> impl Future<Output = Result<Option<TaskClaim>, BackendError>> + Send

Claim a task for execution by a worker node.

Returns Ok(Some(claim)) if successful, Ok(None) if already claimed.

Source

fn release_task_claim( &self, instance_id: &str, task_id: &str, worker_id: &str, ) -> impl Future<Output = Result<(), BackendError>> + Send

Release a task claim.

Source

fn extend_task_claim( &self, instance_id: &str, task_id: &str, worker_id: &str, additional_duration: Duration, ) -> impl Future<Output = Result<(), BackendError>> + Send

Extend a task claim’s expiration time.

Source

fn find_available_tasks( &self, worker_id: &str, limit: usize, ) -> impl Future<Output = Result<Vec<AvailableTask>, BackendError>> + Send

Find available tasks across all workflow instances.

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.

Implementors§