Help us shape the future of Go! Take the 2026 Go Developer Survey

workunit

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WorkUnit

type WorkUnit interface {
	// PluginLookup procures the a hook lookup bundle for the wrapped job using
	// the given job hook lookup bundle. Hooks are looked up by job args and
	// otherwise not available to jobexecutor.
	PluginLookup(lookup *pluginlookup.JobPluginLookup) pluginlookup.PluginLookupInterface

	Middleware() []rivertype.WorkerMiddleware
	NextRetry() time.Time
	Timeout() time.Duration
	UnmarshalJob() error
	Work(ctx context.Context) error
}

WorkUnit provides an interface to a struct that wraps a job to be done combined with a work function that can execute it. Its main purpose is to wrap a struct that contains generic types (like a Worker[T] that needs to be invoked with a Job[T]) in such a way as to make it non-generic so that it can be used in other non-generic code like jobExecutor.

Implemented by river.wrapperWorkUnit.

type WorkUnitFactory

type WorkUnitFactory interface {
	// Make a workUnit, which wraps a job to be done and work function that can
	// execute it.
	MakeUnit(jobRow *rivertype.JobRow) WorkUnit
}

WorkUnitFactory provides an interface to a struct that can generate a workUnit, a wrapper around a job to be done combined with a work function that can execute it.

Implemented by river.workUnitFactoryWrapper.

Jump to

Keyboard shortcuts

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