Versions in this module Expand all Collapse all v0 v0.1.1 Nov 10, 2026 v0.1.0 Nov 10, 2026 Changes in this version + const DefaultAwaitPoll + const DefaultAwaitPolls + const DefaultCallbackRetry + const DefaultDispatchLease + const DefaultPollInterval + const LabelAttempt + const LabelBatch + const LabelIndex + var ErrBatchFailed = errors.New("batch: finished with failed or cancelled jobs") + var ErrBatchPending = errors.New("batch: still running") + var ErrClosed = errors.New("batch: the batch has finished or was cancelled") + var ErrDispatching = errors.New("batch: a dispatch of this batch is in progress") + func EnqueueMany(ctx context.Context, c workflow.Client, jobs []workflow.Job) ([]workflow.RunRef, error) + func JobLabels(id ID, idx, attempt int) map[string]string + type AwaitOption func(*awaitConfig) + func AwaitAllowFailures() AwaitOption + func AwaitPoll(d time.Duration) AwaitOption + func AwaitPolls(n int) AwaitOption + type Batch struct + AllowFailures bool + Before string + Catch string + DiscardedAs workflow.Status + Finally string + Jobs []workflow.Job + Labels map[string]string + Name string + Progress string + Then string + type CallbackKind string + const CallbackBefore + const CallbackCatch + const CallbackFinally + const CallbackProgress + const CallbackThen + type GroupRunner interface + RunGroup func(ctx context.Context, group string, jobs []workflow.Job) ([]workflow.RunRef, error) + type GroupSpawner interface + CancelGroup func(ctx context.Context, group string, parent workflow.RunRef, since time.Time) error + SpawnGroup func(ctx context.Context, group string, jobs []workflow.Job) (workflow.RunRef, error) + SpawnsGroups func() bool + type ID string + func AwaitID(run workflow.RunID, step string) ID + func (id ID) String() string + type JobState struct + Attempt int + Ref workflow.RunRef + Status workflow.Status + type LabelSource interface + FindsJobsByLabel func() + type Manager struct + func New(client workflow.Client, store Store, opts ...Option) *Manager + func (m *Manager) Add(ctx context.Context, id ID, jobs ...workflow.Job) error + func (m *Manager) Attach(ctx context.Context) error + func (m *Manager) AwaitStep(name string, build func(ctx context.Context, in []byte) (Batch, error), ...) workflow.Step + func (m *Manager) Cancel(ctx context.Context, id ID) error + func (m *Manager) Dispatch(ctx context.Context, b Batch) (ID, error) + func (m *Manager) Progress(ctx context.Context, id ID) (Progress, error) + func (m *Manager) Prune(ctx context.Context, f PruneFilter) (int, error) + func (m *Manager) ResumeDispatches(ctx context.Context) error + func (m *Manager) RetryCallbacks(ctx context.Context) error + func (m *Manager) RetryFailed(ctx context.Context, id ID) (int, error) + func (m *Manager) RunFinished(ctx context.Context, labels map[string]string, status workflow.Status) error + type ManyEnqueuer interface + EnqueueMany func(ctx context.Context, jobs []workflow.Job) ([]workflow.RunRef, error) + type MemoryStore struct + func NewMemoryStore() *MemoryStore + func (m *MemoryStore) Create(_ context.Context, st State) error + func (m *MemoryStore) Get(_ context.Context, id ID) (State, error) + func (m *MemoryStore) Prune(_ context.Context, f PruneFilter) (int, error) + func (m *MemoryStore) Unfinished(_ context.Context) ([]State, error) + func (m *MemoryStore) Update(_ context.Context, id ID, fn func(*State) error) (State, error) + type Option func(*Manager) + func WithCallbackRetry(d time.Duration) Option + func WithClock(c clock.Clock) Option + func WithCompletionSource(srcs ...Source) Option + func WithDispatchLease(d time.Duration) Option + func WithIDFunc(fn func() (ID, error)) Option + func WithLogger(l *slog.Logger) Option + func WithManualCallbackRetry() Option + func WithResumableDispatch() Option + func WithRetryableJobs() Option + func WithStatusPoll(interval time.Duration) Option + type PendingCallback struct + Attempts int + Job int + Kind CallbackKind + LastError string + RetryAt time.Time + Round int + Workflow string + type Progress struct + Cancelled bool + CancelledJobs int + Discarded int + Failed int + Finished bool + ID ID + Name string + Pending int + Succeeded int + Total int + func (p Progress) Percent() int + func (p Progress) Processed() int + type PruneFilter struct + CancelledBefore time.Time + FinishedBefore time.Time + UnfinishedBefore time.Time + func (f PruneFilter) IsZero() bool + func (f PruneFilter) Matches(st State) bool + type Pruner interface + Prune func(ctx context.Context, f PruneFilter) (int, error) + type RunFinder interface + FindBatchRuns func(ctx context.Context, id ID, since time.Time) (map[int]workflow.RunRef, error) + type Source interface + Attach func(ctx context.Context, m *Manager) error + func HookSource() Source + func PollSource(interval time.Duration) Source + type State struct + AllowFailures bool + Before string + Cancelled bool + CancelledAt time.Time + Catch string + CatchFired bool + Coordinated bool + CreatedAt time.Time + DiscardedAs workflow.Status + DispatchOwner string + DispatchUntil time.Time + Dispatched bool + FailCancelled bool + Finally string + Finished bool + FinishedAt time.Time + Grouped bool + ID ID + Jobs []JobState + Labels map[string]string + Name string + Parent workflow.RunRef + Pending []PendingCallback + Progress string + Round int + Spec []workflow.Job + Then string + func (s State) Open() bool + type Store interface + Create func(ctx context.Context, st State) error + Get func(ctx context.Context, id ID) (State, error) + Unfinished func(ctx context.Context) ([]State, error) + Update func(ctx context.Context, id ID, fn func(*State) error) (State, error)