pub struct TaskDescriptor {Show 13 fields
pub name: &'static str,
pub invoke: InvokeFn,
pub signature_json: &'static str,
pub signature_hash: u64,
pub default_priority: i32,
pub default_pool: &'static str,
pub default_retry_max_attempts: u32,
pub default_retry_base_delay_ms: u64,
pub default_retry_backoff_multiplier: f64,
pub default_retry_max_delay_ms: u64,
pub default_rate_max_in_flight: u32,
pub default_rate_max_enqueue_per_second: u32,
pub default_idempotency_mode: Option<IdempotencyMode>,
}Expand description
Descriptor for a registered task.
Registration defaults flow into TaskConfig on first enqueue.
Use TaskDescriptor::with_defaults to set retry, rate, priority, and pool in one call.
§Signature versioning
signature_json— JSON schema string describing task parameters (convention for tooling; Boson does not validate against it at runtime).signature_hash— hash of the parameter schema/version. Stored on eachJobat enqueue; if the registered task’s hash changes while a job is still active, dispatch returnsBosonError::SignatureMismatch. Bumpsignature_hashwhen you change parameter shape incompatibly.
Fields§
§name: &'static strUnique task name (registry key and enqueue target).
invoke: InvokeFnFunction to invoke the task.
signature_json: &'static strJSON schema string for parameters (documentation / tooling; not validated at runtime).
signature_hash: u64Version hash checked against enqueued jobs; change when parameters change incompatibly.
default_priority: i32Default priority (lower = higher priority).
default_pool: &'static strDefault pool name for worker assignment.
default_retry_max_attempts: u32Default retry max attempts (see RetryPolicy::max_attempts).
default_retry_base_delay_ms: u64Default retry base delay ms (see RetryPolicy::base_delay_ms).
default_retry_backoff_multiplier: f64Default retry backoff multiplier (see RetryPolicy::backoff_multiplier).
default_retry_max_delay_ms: u64Default retry max delay ms (see RetryPolicy::max_delay_ms).
default_rate_max_in_flight: u32Default max in-flight jobs (see RateLimitPolicy::max_in_flight; 0 = unlimited).
default_rate_max_enqueue_per_second: u32Default max enqueues per second (see RateLimitPolicy::max_enqueue_per_second; 0 = unlimited).
default_idempotency_mode: Option<IdempotencyMode>Per-task idempotency override (None = inherit runtime default).
Implementations§
Source§impl TaskDescriptor
impl TaskDescriptor
Sourcepub const fn new(name: &'static str, invoke: InvokeFn) -> Self
pub const fn new(name: &'static str, invoke: InvokeFn) -> Self
Minimal descriptor for tests (signature_json "{}", signature_hash 0).
Sourcepub const fn with_defaults(
name: &'static str,
invoke: InvokeFn,
signature_json: &'static str,
signature_hash: u64,
defaults: TaskDefaults,
) -> Self
pub const fn with_defaults( name: &'static str, invoke: InvokeFn, signature_json: &'static str, signature_hash: u64, defaults: TaskDefaults, ) -> Self
Descriptor with grouped policy defaults.
Sourcepub const fn with_policy(
name: &'static str,
invoke: InvokeFn,
signature_json: &'static str,
signature_hash: u64,
priority: i32,
pool: &'static str,
max_attempts: u32,
base_delay_ms: u64,
backoff_multiplier: f64,
max_delay_ms: u64,
max_in_flight: u32,
max_enqueue_per_second: u32,
idempotency_mode: Option<IdempotencyMode>,
) -> Self
pub const fn with_policy( name: &'static str, invoke: InvokeFn, signature_json: &'static str, signature_hash: u64, priority: i32, pool: &'static str, max_attempts: u32, base_delay_ms: u64, backoff_multiplier: f64, max_delay_ms: u64, max_in_flight: u32, max_enqueue_per_second: u32, idempotency_mode: Option<IdempotencyMode>, ) -> Self
Descriptor with explicit per-field policy defaults.
Used by the #[task] attribute when policy fields are set on the handler.
Prefer Self::with_defaults for manual registration in tests.
Sourcepub fn to_task_config(&self) -> TaskConfig
pub fn to_task_config(&self) -> TaskConfig
Materialize descriptor defaults into a TaskConfig.
Trait Implementations§
Source§impl Clone for TaskDescriptor
impl Clone for TaskDescriptor
Source§fn clone(&self) -> TaskDescriptor
fn clone(&self) -> TaskDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more