Documentation
¶
Overview ¶
Package job is the job tier: a Base, one per job, decorates the job it builds with the job tier (recovery, logging, tracing, metrics, timeout), 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 {
// Subject runs the job through the tier; it supplies Name and Exec.
decorate.Subject
}
Base is the embeddable core of one job named by its Subject: the job runs through the job tier as the operation "execute", the snake_case name of interfaces.AnyJob's Execute. Func, Local and Wrap build the job; build one job per Base, so each job is its own component in the config. The zero Base builds an undecorated job.
func NewBase ¶ added in v0.0.7
func NewBase(decs decorate.Decorations, name string) (Base, error)
NewBase builds the Base for the job named name, decorated from decs as the job-tier component name (its operation as name+".execute"). A decoration that fails to resolve is an error.
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) 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.