Documentation
¶
Overview ¶
Package job builds interfaces.AnyJob values: Base decorates every job it builds with the job tier (recovery, logging, tracing, metrics, timeout) once, so a job is a function plus its name and group, never a hand-written AnyJob type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Base ¶ added in v0.0.7
type Base struct {
// contains filtered or unexported fields
}
Base builds decorated jobs. The zero value applies recovery only, so Base{} is a working undecorated builder.
func NewBaseFrom ¶ added in v0.0.11
func NewBaseFrom(decs decorate.Decorations, prefix string) Base
NewBaseFrom returns a Base whose jobs each take their own decoration from decs: a job named name is the job-tier component prefix+"."+name, so the config can tune one job, or every job under prefix.
func (Base) Func ¶ added in v0.0.7
func (b Base) Func(name, group string, run Run) interfaces.AnyJob
Func builds the job name in group that runs run.
func (Base) Local ¶ added in v0.0.8
func (b Base) Local( name, group string, fn func(context.Context) (types.StepResults, error), ) interfaces.AnyJob
Local builds the job name in group that runs fn, in-process work (a seeder, a sync) that needs no command runner or root; a gate of Local jobs runs with gate.RunLocal.
func (Base) Named ¶ added in v0.0.11
Named returns the Base whose jobs sit beneath sub: from a Base of prefix "events", Named("sweep") makes a job "reap" the component "events.sweep.reap". A Base built by NewBase shares one decoration and is returned unchanged.
func (Base) Wrap ¶ added in v0.0.7
func (b Base) Wrap(j interfaces.AnyJob) interfaces.AnyJob
Wrap decorates an existing job, keeping its metadata.
type Run ¶ added in v0.0.7
type Run func( ctx context.Context, runner interfaces.CommandRunner, root string, ) (types.StepResults, error)
Run is a job's work: it executes against runner under root and returns the job's step results.