Skip to main content

Boson

Struct Boson 

Source
pub struct Boson { /* private fields */ }
Expand description

Boson work engine — enqueue, admin reads, and worker orchestration.

Implementations§

Source§

impl Boson

Source

pub fn from_parts( backend: Arc<dyn QueueBackend>, registry: Arc<TaskRegistry>, worker: WorkerSettings, ) -> Self

Construct from injected parts (used by builder and tests).

Source

pub fn from_parts_with_idempotency( backend: Arc<dyn QueueBackend>, registry: Arc<TaskRegistry>, worker: WorkerSettings, idempotency_mode: IdempotencyMode, ) -> Self

Construct with an explicit default idempotency mode.

Source

pub const fn idempotency_mode(&self) -> IdempotencyMode

Runtime default idempotency mode (builder / task override may change per enqueue).

Source

pub const fn worker_settings(&self) -> &WorkerSettings

Worker settings this instance was built with.

Source

pub fn runtime_label(&self) -> &str

Telemetry/runtime label (topology slug or embedded).

Source

pub fn queue_backend(&self) -> Arc<dyn QueueBackend>

Queue backend handle.

Source

pub fn registry(&self) -> &TaskRegistry

Task registry.

Source

pub async fn resolve_task_config(&self, task_name: &str) -> Result<TaskConfig>

Resolve task config from backend or registry defaults.

Precedence: persisted backend config, else descriptor policy defaults, then runtime idempotency fallback when the mode is unset.

§Errors

Returns an error if the task is unknown or the backend fails.

Source

pub async fn resolve_priority_pool( &self, task_name: &str, ) -> Result<(i32, String)>

Resolve priority and pool for enqueue.

§Errors

Returns an error if the task is unknown or the backend fails.

Source

pub async fn enqueue( &self, task_name: &str, actor_json: Value, params_json: Value, idempotency_key: Option<String>, ) -> Result<String>

Enqueue a job.

Priority and pool come from persisted TaskConfig merged with TaskDescriptor defaults. Optional idempotency_key deduplicates non-terminal jobs. Rate limits may return BosonError::RateLimited.

§Errors

Returns an error if the task is unknown, rate limits apply, or the backend fails.

Source

pub async fn get_job(&self, job_id: &str) -> Result<Option<Job>>

Get a job by id.

§Errors

Returns an error if the backend fails.

Source

pub async fn list_jobs( &self, status_filter: Option<JobStatus>, offset: usize, limit: usize, ) -> Result<Vec<Job>>

List jobs with optional status filter.

§Errors

Returns an error if the backend fails.

Source

pub async fn cancel_job(&self, job_id: &str) -> Result<()>

Cancel a job if still active.

§Errors

Returns an error if the job is not found or the backend fails.

Source

pub async fn get_task_config(&self, task_name: &str) -> Result<TaskConfig>

Get or default task config.

§Errors

Returns an error if the task is unknown or the backend fails.

Source

pub async fn upsert_task_config(&self, config: TaskConfig) -> Result<()>

Upsert task config.

§Errors

Returns an error if the backend fails.

Source

pub async fn list_runs( &self, job_id_filter: Option<&str>, offset: usize, limit: usize, ) -> Result<Vec<Run>>

List runs.

§Errors

Returns an error if the backend fails.

Source

pub async fn get_run(&self, run_id: &str) -> Result<Option<Run>>

Get run by id.

§Errors

Returns an error if the backend fails.

Source

pub async fn count_jobs(&self, status_filter: Option<JobStatus>) -> Result<u64>

Count jobs.

§Errors

Returns an error if the backend fails.

Source

pub async fn count_runs(&self, job_id_filter: Option<&str>) -> Result<u64>

Count runs.

§Errors

Returns an error if the backend fails.

Source

pub async fn count_runs_since(&self, since: DateTime<Utc>) -> Result<u64>

Count runs since timestamp.

§Errors

Returns an error if the backend fails.

Source

pub async fn count_jobs_for_task( &self, task_name: &str, status: Option<JobStatus>, ) -> Result<u64>

Count jobs for one task.

§Errors

Returns an error if the backend fails.

Source

pub async fn task_run_stats(&self, task_name: &str) -> Result<TaskRunStats>

Aggregate run stats for one task.

§Errors

Returns an error if the backend fails.

Source§

impl Boson

Source

pub fn builder() -> BosonBuilder

Create a new builder.

Trait Implementations§

Source§

impl Clone for Boson

Source§

fn clone(&self) -> Boson

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Boson

§

impl !UnwindSafe for Boson

§

impl Freeze for Boson

§

impl Send for Boson

§

impl Sync for Boson

§

impl Unpin for Boson

§

impl UnsafeUnpin for Boson

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.