jobcompleter

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncJobCompleter

type AsyncJobCompleter struct {
	baseservice.BaseService
	// contains filtered or unexported fields
}

func NewAsyncCompleter

func NewAsyncCompleter(archetype *baseservice.Archetype, exec PartialExecutor, concurrency uint32) *AsyncJobCompleter

func (*AsyncJobCompleter) JobSetStateIfRunning added in v0.0.13

func (c *AsyncJobCompleter) JobSetStateIfRunning(stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

func (*AsyncJobCompleter) Subscribe

func (c *AsyncJobCompleter) Subscribe(subscribeFunc func(update CompleterJobUpdated))

func (*AsyncJobCompleter) Wait

func (c *AsyncJobCompleter) Wait()

type CompleterJobUpdated

type CompleterJobUpdated struct {
	Job      *rivertype.JobRow
	JobStats *jobstats.JobStatistics
}

type InlineJobCompleter

type InlineJobCompleter struct {
	baseservice.BaseService
	// contains filtered or unexported fields
}

func NewInlineCompleter

func NewInlineCompleter(archetype *baseservice.Archetype, exec PartialExecutor) *InlineJobCompleter

func (*InlineJobCompleter) JobSetStateIfRunning added in v0.0.13

func (c *InlineJobCompleter) JobSetStateIfRunning(stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

func (*InlineJobCompleter) Subscribe

func (c *InlineJobCompleter) Subscribe(subscribeFunc func(update CompleterJobUpdated))

func (*InlineJobCompleter) Wait

func (c *InlineJobCompleter) Wait()

type JobCompleter

type JobCompleter interface {
	// JobSetState sets a new state for the given job, as long as it's
	// still running (i.e. its state has not changed to something else already).
	JobSetStateIfRunning(stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

	// Subscribe injects a callback which will be invoked whenever a job is
	// updated.
	Subscribe(subscribeFunc func(update CompleterJobUpdated))

	// Wait waits for all ongoing completions to finish, enabling graceful
	// shutdown.
	Wait()
}

type PartialExecutor added in v0.0.23

type PartialExecutor interface {
	JobSetStateIfRunning(ctx context.Context, params *riverdriver.JobSetStateIfRunningParams) (*rivertype.JobRow, error)
}

PartialExecutor is always a riverdriver.Executor under normal circumstances, but is a minimal interface with the functions needed for completers to work to more easily facilitate mocking.

Jump to

Keyboard shortcuts

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