workunit

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MPL-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.PluginLookup

	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