Skip to main content

JobProvider

Trait JobProvider 

Source
pub trait JobProvider: Send + Sync {
    // Required methods
    fn submit(&self, job: JobSpec) -> ProviderResult<()>;
    fn claim(
        &self,
        capability: &CapabilityId,
        holder_core_id: &CoreId,
        now_ms: u64,
        lease_duration_ms: u64,
    ) -> ProviderResult<Option<JobLease>>;
    fn complete(
        &self,
        lease: &JobLease,
        completion: JobCompletion,
    ) -> ProviderResult<()>;

    // Provided method
    fn atomicity(&self) -> JobAtomicity { ... }
}
Expand description

Provider contract for durable, capability-routed Runtime jobs.

Providers must offer at-least-once delivery. submit atomically inserts by job_id or confirms the equivalent existing job. claim atomically selects one eligible job, increments its fencing epoch, and stores its lease. complete atomically compares the full lease fence and applies exactly one terminal or retry transition. A stale or duplicate fence must be rejected.

Required Methods§

Source

fn submit(&self, job: JobSpec) -> ProviderResult<()>

Persists a new job idempotently by job_id.

Source

fn claim( &self, capability: &CapabilityId, holder_core_id: &CoreId, now_ms: u64, lease_duration_ms: u64, ) -> ProviderResult<Option<JobLease>>

Claims the next eligible job for a capability and returns a fenced lease.

Source

fn complete( &self, lease: &JobLease, completion: JobCompletion, ) -> ProviderResult<()>

Completes or reschedules a job while enforcing the supplied lease fence.

Provided Methods§

Source

fn atomicity(&self) -> JobAtomicity

Reports the atomicity model implemented by this provider.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§