job

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 4 Imported by: 0

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

func Tier added in v0.0.7

func Tier() decorate.Tier

Tier is the job decoration tier: recovery outermost, then logging, tracing, metrics, and the per-job timeout. A job runs as the operation "Execute".

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 NewBase added in v0.0.7

func NewBase(deps decorate.Deps) Base

NewBase returns a Base that decorates all its jobs with deps.

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

func (b Base) Named(sub string) Base

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL