interface
TaskStore
General-purpose durable queue persistence.
Properties
| Property | Type | Description |
|---|---|---|
EnqueueTask | func(context.Context, | The EnqueueTask value. |
FindTask | func(context.Context, | The FindTask value. |
ListTasks | func(context.Context, | The ListTasks value. |
CancelTask | func(context.Context, | The CancelTask value. |
DismissTaskForTarget | func(context.Context, | DismissTaskForTarget removes one task only when its slug and target match. This powers target-scoped action lists such as scheduled publishing: every listed queued, running, failed, or canceled item remains dismissible while general CancelTask keeps retained cancellation status for typed callers. |
ClaimTasks | func(context.Context, | The ClaimTasks value. |
HeartbeatTask | func(context.Context, | The HeartbeatTask value. |
CompleteTask | func(context.Context, | The CompleteTask value. |
FailTask | func(context.Context, | The FailTask value. |
ReleaseTask | func(context.Context, | The ReleaseTask value. |
PruneTasks | func(context.Context, | The PruneTasks value. |
How it works
Use an authoritative store clock, reclaim expired leases, enforce concurrency keys atomically, and return ErrTaskLeaseLost when the opaque lease token no longer owns running work. Public ValidateTask* functions validate every request boundary.
Full signature
type TaskStore interface {
EnqueueTask(context.Context, Task) (Task, error)
FindTask(context.Context, string) (Task, error)
ListTasks(context.Context, TaskList) ([]Task, error)
CancelTask(context.Context, string) error
// DismissTaskForTarget removes one task only when its slug and target match.
// Queued, failed, and canceled items are dismissible; running work remains
// lease-owned because removing its record cannot stop its handler safely.
DismissTaskForTarget(context.Context, string, string, DocumentReference) error
ClaimTasks(context.Context, TaskClaim) ([]Task, error)
HeartbeatTask(context.Context, string, string, time.Duration) error
CompleteTask(context.Context, string, string, json.RawMessage) error
FailTask(context.Context, TaskFailure) error
ReleaseTask(context.Context, string, string, time.Duration, string, string) error
PruneTasks(context.Context, int) (int, error)
}