workunit

package
v0.12.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MPL-2.0 Imports: 3 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 {
	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