quasar_jobs/worker
Typed durable worker definitions.
Types
pub type CompletionMode {
RuntimeManaged
WorkerManaged
}
Constructors
-
RuntimeManaged -
WorkerManaged
pub type Context {
Context(
job_id: job.JobId,
attempt: Int,
execution_token: job.ExecutionToken,
)
}
Constructors
-
Context( job_id: job.JobId, attempt: Int, execution_token: job.ExecutionToken, )
pub opaque type Definition
Values
pub fn job(worker: Worker(input), input: input) -> job.NewJob
Encodes typed input into a persistable job payload.
pub fn new(
name name: String,
encode encode: fn(input) -> String,
decode decode: fn(String) -> Result(input, String),
perform perform: fn(input, Context) -> Result(Nil, String),
) -> Worker(input)
Defines a typed durable worker without macros.