A versioned, JSON-safe description of restartable task work.
Work descriptors contain data only. The type selects an application-owned
executor and the idempotency_key remains stable across claims, process
restarts, and execution retries. The immutable retry policy is expanded to
exact delays before persistence, so an in-flight task does not change policy
when application configuration changes. Applications should use the stable
key when making externally visible side effects idempotent.
Summary
Functions
Decodes and validates a persistence map produced by to_map/1.
Builds a validated application-defined work descriptor.
Builds a validated work descriptor or raises ArgumentError.
Returns the descriptor with a validated immutable retry policy.
Encodes a descriptor as a stable JSON-safe persistence map.
Builds the standard descriptor for a durable tools/call invocation.
Validates a descriptor constructed locally or decoded by an adapter.
Types
@type t() :: %Snodo.Extensions.Tasks.Work{ idempotency_key: String.t(), input: map(), retry_policy: Snodo.Extensions.Tasks.RetryPolicy.t(), type: String.t() }
Functions
Decodes and validates a persistence map produced by to_map/1.
Builds a validated application-defined work descriptor.
Builds a validated work descriptor or raises ArgumentError.
@spec put_retry_policy(t(), Snodo.Extensions.Tasks.RetryPolicy.t()) :: {:ok, t()} | {:error, term()}
Returns the descriptor with a validated immutable retry policy.
Encodes a descriptor as a stable JSON-safe persistence map.
Builds the standard descriptor for a durable tools/call invocation.
Validates a descriptor constructed locally or decoded by an adapter.