pub struct Boson { /* private fields */ }Expand description
Boson work engine — enqueue, admin reads, and worker orchestration.
Implementations§
Source§impl Boson
impl Boson
Sourcepub fn from_parts(
backend: Arc<dyn QueueBackend>,
registry: Arc<TaskRegistry>,
worker: WorkerSettings,
) -> Self
pub fn from_parts( backend: Arc<dyn QueueBackend>, registry: Arc<TaskRegistry>, worker: WorkerSettings, ) -> Self
Construct from injected parts (used by builder and tests).
Sourcepub fn from_parts_with_idempotency(
backend: Arc<dyn QueueBackend>,
registry: Arc<TaskRegistry>,
worker: WorkerSettings,
idempotency_mode: IdempotencyMode,
) -> Self
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.
Sourcepub const fn idempotency_mode(&self) -> IdempotencyMode
pub const fn idempotency_mode(&self) -> IdempotencyMode
Runtime default idempotency mode (builder / task override may change per enqueue).
Sourcepub const fn worker_settings(&self) -> &WorkerSettings
pub const fn worker_settings(&self) -> &WorkerSettings
Worker settings this instance was built with.
Sourcepub fn runtime_label(&self) -> &str
pub fn runtime_label(&self) -> &str
Telemetry/runtime label (topology slug or embedded).
Sourcepub fn queue_backend(&self) -> Arc<dyn QueueBackend>
pub fn queue_backend(&self) -> Arc<dyn QueueBackend>
Queue backend handle.
Sourcepub fn registry(&self) -> &TaskRegistry
pub fn registry(&self) -> &TaskRegistry
Task registry.
Sourcepub async fn resolve_task_config(&self, task_name: &str) -> Result<TaskConfig>
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.
Sourcepub async fn resolve_priority_pool(
&self,
task_name: &str,
) -> Result<(i32, String)>
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.
Sourcepub async fn enqueue(
&self,
task_name: &str,
actor_json: Value,
params_json: Value,
idempotency_key: Option<String>,
) -> Result<String>
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.
Sourcepub async fn list_jobs(
&self,
status_filter: Option<JobStatus>,
offset: usize,
limit: usize,
) -> Result<Vec<Job>>
pub async fn list_jobs( &self, status_filter: Option<JobStatus>, offset: usize, limit: usize, ) -> Result<Vec<Job>>
Sourcepub async fn cancel_job(&self, job_id: &str) -> Result<()>
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.