Versions in this module Expand all Collapse all v0 v0.1.1 Nov 10, 2026 Changes in this version + func RequireSource(allowed ...workflow.Source) workflow.EnqueueMiddleware v0.1.0 Nov 10, 2026 Changes in this version + const ClaimCheckLabel + const DefaultAlertDedup + const DefaultArgsKeyPrefix + const DefaultPingTimeout + const UniqueKeyLabel + const UniqueOwnerLabel + const UniqueTag + var ErrBlobNotFound = errors.New("workflow/middleware: blob not found") + var ErrDecode = errors.New("workflow/middleware: payload does not decode") + var ErrPanic = errors.New("workflow/middleware: step panicked") + var ErrReleased = errors.New("workflow/middleware: step released") + var ErrThrottled = errors.New("workflow/middleware: step throttled after repeated errors") + func AlertPlugin(a Alerter, cfg AlertConfig) workflow.Plugin + func Alerts(a Alerter, cfg AlertConfig) workflow.RunFinishedFunc + func CaptureOutput(sink OutputSink, opts ...CaptureOption) workflow.Middleware + func Chain(mws ...workflow.Middleware) workflow.Middleware + func ChainEnqueue(mws ...workflow.EnqueueMiddleware) workflow.EnqueueMiddleware + func Debounce(c workflow.Client, clk clock.Clock, key func(workflow.Job) string, ...) (workflow.EnqueueMiddleware, error) + func DecodeStep(c Codec) workflow.Middleware + func EncodeEnqueue(c Codec) workflow.EnqueueMiddleware + func FailOn(match func(error) bool) workflow.Middleware + func FormatOutput(w io.Writer, out Output) error + func Logging(l *slog.Logger, clk clock.Clock, opts ...LoggingOption) workflow.Middleware + func MaxPayload(limit int) workflow.EnqueueMiddleware + func OutputLogger(ctx context.Context, fallback *slog.Logger) *slog.Logger + func PayloadVersion(current int) workflow.EnqueueMiddleware + func Recover(l *slog.Logger) workflow.Middleware + func Release(when func(ctx context.Context, in []byte) bool, delay time.Duration) workflow.Middleware + func ReleaseUniqueOnStart(store UniqueStore) workflow.Middleware + func Report(r workflow.Reporter, cfg ReportConfig) workflow.Plugin + func ReportAttempts(r workflow.Reporter, cfg ReportConfig) workflow.Middleware + func ReportFailures(r workflow.Reporter, cfg ReportConfig) workflow.RunFinishedFunc + func Route(rules ...RouteRule) workflow.EnqueueMiddleware + func Skip(skip func(ctx context.Context, in []byte) bool) workflow.Middleware + func Stuck(cfg StuckConfig) workflow.Middleware + func ThrottleErrors(cfg ThrottleConfig) (workflow.Middleware, error) + func Timeout(d time.Duration) workflow.Middleware + func Unique(by func(workflow.Job) string, store UniqueStore, ttl time.Duration) workflow.EnqueueMiddleware + func UniqueByArgs(opts ...ArgsOption) func(workflow.Job) string + func UniqueUntilFinished(c workflow.Client, by func(workflow.Job) string, store UniqueStore, ...) (workflow.EnqueueMiddleware, error) + func UniqueUntilStarted(by func(workflow.Job) string, store UniqueStore, ttl time.Duration) (enqueue workflow.EnqueueMiddleware, step workflow.Middleware) + func UniqueWith(cfg UniqueConfig) (workflow.EnqueueMiddleware, error) + func WithCodec(c workflow.Client, codec Codec, mws ...workflow.EnqueueMiddleware) workflow.Client + func WrapClient(c workflow.Client, mws ...workflow.EnqueueMiddleware) workflow.Client + type Alert struct + Key string + Suppressed int + type AlertConfig struct + Clock clock.Clock + Discarded bool + Key func(workflow.Failure) string + Limiter AlertLimiter + Logger *slog.Logger + When func(workflow.Failure) bool + type AlertLimiter interface + Allow func(ctx context.Context, key string, at time.Time) (ok bool, suppressed int, err error) + type AlertLimits struct + Dedup time.Duration + Max int + Per time.Duration + type Alerter interface + Alert func(ctx context.Context, a Alert) error + type AlerterFunc func(ctx context.Context, a Alert) error + func (fn AlerterFunc) Alert(ctx context.Context, a Alert) error + type ArgsOption func(*argsKey) + func ArgsFields(names ...string) ArgsOption + func ArgsKeyPrefix(p string) ArgsOption + func ArgsLabels(keys ...string) ArgsOption + func ArgsQueue() ArgsOption + func ArgsTagged[T any]() ArgsOption + type BlobPrefixDeleter interface + DeletePrefix func(ctx context.Context, prefix string) error + type BlobStore interface + Delete func(ctx context.Context, key string) error + Get func(ctx context.Context, key string) ([]byte, error) + Put func(ctx context.Context, key string, data []byte) error + type CaptureOption func(*captureConfig) + func CaptureClock(clk clock.Clock) CaptureOption + func CaptureLevel(l slog.Leveler) CaptureOption + func CaptureOnSinkError(fn func(ctx context.Context, out Output, err error)) CaptureOption + func CaptureOnly(keep func(workflow.StepInfo) bool) CaptureOption + func CaptureOnlyFailures() CaptureOption + func CaptureResult() CaptureOption + func CaptureTee(h slog.Handler) CaptureOption + type CircuitPolicy struct + Cooldown time.Duration + MaxErrors int + Window time.Duration + type CircuitStore interface + IsOpen func(ctx context.Context, key string) (bool, error) + RecordError func(ctx context.Context, key string, p CircuitPolicy) error + Reset func(ctx context.Context, key string) error + type ClaimCheck struct + func NewClaimCheck(store BlobStore, threshold int, opts ...ClaimCheckOption) (*ClaimCheck, error) + func (cc *ClaimCheck) CleanupOnFinish(c workflow.Client) error + func (cc *ClaimCheck) Enqueue() workflow.EnqueueMiddleware + func (cc *ClaimCheck) Step() workflow.Middleware + type ClaimCheckOption func(*ClaimCheck) + func WithClaimKeys(fn func() (string, error)) ClaimCheckOption + type Codec interface + Decode func(encoded []byte) ([]byte, error) + Encode func(plain []byte) ([]byte, error) + func Encrypt(key []byte, oldKeys ...[]byte) (Codec, error) + type DebounceBurst struct + First time.Time + Ref workflow.RunRef + RunAt time.Time + type DebounceOption func(*debouncer) + func WithDebounceStore(s DebounceStore) DebounceOption + type DebounceStore interface + Get func(ctx context.Context, key string) (b DebounceBurst, found bool, err error) + Swap func(ctx context.Context, key string, b DebounceBurst) (prev DebounceBurst, found bool, err error) + type FileMode int + const FileAppend + const FileReplace + type LoggingOption func(*loggingConfig) + func WithLogLevel(fn func(ctx context.Context, ev StepLogEvent) slog.Level) LoggingOption + type MemoryAlertLimiter struct + func NewMemoryAlertLimiter(clk clock.Clock, l AlertLimits) *MemoryAlertLimiter + func (m *MemoryAlertLimiter) Allow(_ context.Context, key string, at time.Time) (bool, int, error) + type MemoryBlobStore struct + func NewMemoryBlobStore() *MemoryBlobStore + func (m *MemoryBlobStore) Delete(_ context.Context, key string) error + func (m *MemoryBlobStore) DeletePrefix(_ context.Context, prefix string) error + func (m *MemoryBlobStore) Get(_ context.Context, key string) ([]byte, error) + func (m *MemoryBlobStore) Len() int + func (m *MemoryBlobStore) Put(_ context.Context, key string, data []byte) error + type MemoryCircuit struct + func NewMemoryCircuit(clk clock.Clock) *MemoryCircuit + func (m *MemoryCircuit) IsOpen(_ context.Context, key string) (bool, error) + func (m *MemoryCircuit) RecordError(_ context.Context, key string, p CircuitPolicy) error + func (m *MemoryCircuit) Reset(_ context.Context, key string) error + type MemoryDebounce struct + func NewMemoryDebounce(clk clock.Clock) *MemoryDebounce + func (m *MemoryDebounce) Get(_ context.Context, key string) (DebounceBurst, bool, error) + func (m *MemoryDebounce) Swap(_ context.Context, key string, b DebounceBurst) (DebounceBurst, bool, error) + type MemoryUnique struct + func NewMemoryUnique(clk clock.Clock) *MemoryUnique + func (m *MemoryUnique) Acquire(_ context.Context, key, owner string, ttl time.Duration) (bool, error) + func (m *MemoryUnique) Holder(_ context.Context, key string) (string, workflow.RunRef, bool, error) + func (m *MemoryUnique) Release(_ context.Context, key, owner string) error + func (m *MemoryUnique) SetHolder(_ context.Context, key, owner string, ref workflow.RunRef) error + type Output struct + Err error + Finished time.Time + HasInfo bool + Info workflow.StepInfo + Records []OutputRecord + Result []byte + Started time.Time + type OutputRecord struct + Attrs []slog.Attr + Level slog.Level + Message string + Time time.Time + type OutputSink interface + Deliver func(ctx context.Context, out Output) error + func FileSink(path string, mode FileMode) OutputSink + func WriterSink(w io.Writer) OutputSink + type OutputSinkFunc func(ctx context.Context, out Output) error + func (f OutputSinkFunc) Deliver(ctx context.Context, out Output) error + type PingFunc func(ctx context.Context, target string) error + func HTTPPing(client *http.Client) PingFunc + type Pinger struct + func NewPinger(send PingFunc, opts ...PingerOption) *Pinger + func (p *Pinger) Run(target string) func(ctx context.Context, ev workflow.RunEvent) + func (p *Pinger) Tick(target string) func(ctx context.Context, t workflow.Tick) + type PingerOption func(*Pinger) + func WithPingLogger(l *slog.Logger) PingerOption + func WithPingTimeout(d time.Duration) PingerOption + type ReportConfig struct + Attempts bool + Clock clock.Clock + Discarded bool + type RouteRule struct + Labels map[string]string + Match func(workflow.Job) bool + Workflow string + type StepLogEvent struct + Err error + HasInfo bool + Info workflow.StepInfo + Phase StepPhase + type StepPhase string + const StepFailed + const StepFinished + const StepStarted + type StuckConfig struct + After func(workflow.StepInfo) time.Duration + Clock clock.Clock + Default time.Duration + OnStuck func(ctx context.Context, ev StuckEvent) + type StuckEvent struct + Info workflow.StepInfo + Running time.Duration + Started time.Time + type ThrottleConfig struct + Clock clock.Clock + Cooldown time.Duration + Key func(ctx context.Context, in []byte) string + MaxErrors int + Store CircuitStore + Window time.Duration + type UniqueConfig struct + By func(workflow.Job) string + Client workflow.Client + ReturnExisting bool + States []workflow.Status + Store UniqueStore + TTL time.Duration + type UniqueHolders interface + Holder func(ctx context.Context, key string) (owner string, ref workflow.RunRef, ok bool, err error) + SetHolder func(ctx context.Context, key, owner string, ref workflow.RunRef) error + type UniqueStore interface + Acquire func(ctx context.Context, key, owner string, ttl time.Duration) (bool, error) + Release func(ctx context.Context, key, owner string) error