interface

TaskStore

General-purpose durable queue persistence.

Properties

PropertyTypeDescription
EnqueueTaskfunc(context.Context, Task) (Task, error)The EnqueueTask value.
FindTaskfunc(context.Context, string) (Task, error)The FindTask value.
ListTasksfunc(context.Context, TaskList) ([]Task, error)The ListTasks value.
CancelTaskfunc(context.Context, string) errorThe CancelTask value.
DismissTaskForTargetfunc(context.Context, string, string, DocumentReference) errorDismissTaskForTarget 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.
ClaimTasksfunc(context.Context, TaskClaim) ([]Task, error)The ClaimTasks value.
HeartbeatTaskfunc(context.Context, string, string, time.Duration) errorThe HeartbeatTask value.
CompleteTaskfunc(context.Context, string, string, json.RawMessage) errorThe CompleteTask value.
FailTaskfunc(context.Context, TaskFailure) errorThe FailTask value.
ReleaseTaskfunc(context.Context, string, string, time.Duration, string, string) errorThe ReleaseTask value.
PruneTasksfunc(context.Context, int) (int, error)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) }

Source store/store.go:915