jobwalker

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0, MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobHandler

type JobHandler[Job any, State any] func(ctx context.Context, j Job, spawn func(Job) error, state WrappedState[State]) error

JobHandler handles the specified job and uses the passed in function to spawn more jobs. The handler should stop processing if spawn errors, returning the error from spawn

type JobWalker

type JobWalker[Job, State any] func(ctx context.Context, initial []Job, initialState State, handler JobHandler[Job, State]) (State, error)

JobWalker processes a set of jobs that spawn other jobs, all while modifying a final state

type WrappedState

type WrappedState[State any] interface {
	Access() State
	Modify(func(State) State)
	// CmpSwap calls the "willModify" function (potentially multiple times) and calls modify if it returns true
	CmpSwap(willModify func(State) bool, modify func(State) State) bool
}

WrappedState is a wrapper around any state to enable atomic access and modification

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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