jobcompleter

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MPL-2.0 Imports: 15 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 AsyncCompleter

type AsyncCompleter struct {
	baseservice.BaseService
	startstop.BaseStartStop
	// contains filtered or unexported fields
}

func NewAsyncCompleter

func NewAsyncCompleter(archetype *baseservice.Archetype, schema string, exec riverdriver.Executor, pilot riverpilot.Pilot, subscribeCh SubscribeChan) *AsyncCompleter

func (*AsyncCompleter) JobSetStateIfRunning

func (c *AsyncCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

func (*AsyncCompleter) ResetSubscribeChan

func (c *AsyncCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)

func (*AsyncCompleter) Start

func (c *AsyncCompleter) Start(ctx context.Context) error

type BatchCompleter

type BatchCompleter struct {
	baseservice.BaseService
	startstop.BaseStartStop
	// contains filtered or unexported fields
}

BatchCompleter accumulates incoming completions, and instead of completing them immediately, every so often complete many of them as a single efficient batch. To minimize the amount of driver surface area we need, the batching is only performed for jobs being changed to a `completed` state, which we expect to the vast common case under normal operation. The completer embeds an AsyncCompleter to perform other non-`completed` state completions.

func NewBatchCompleter

func NewBatchCompleter(archetype *baseservice.Archetype, schema string, exec riverdriver.Executor, pilot riverpilot.Pilot, subscribeCh SubscribeChan) *BatchCompleter

func (*BatchCompleter) JobSetStateIfRunning

func (c *BatchCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

func (*BatchCompleter) ResetSubscribeChan

func (c *BatchCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)

func (*BatchCompleter) Start

func (c *BatchCompleter) Start(ctx context.Context) error

type CompleterJobUpdated

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

type InlineCompleter

type InlineCompleter struct {
	baseservice.BaseService
	startstop.BaseStartStop
	// contains filtered or unexported fields
}

func NewInlineCompleter

func NewInlineCompleter(archetype *baseservice.Archetype, schema string, exec riverdriver.Executor, pilot riverpilot.Pilot, subscribeCh SubscribeChan) *InlineCompleter

func (*InlineCompleter) JobSetStateIfRunning

func (c *InlineCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

func (*InlineCompleter) ResetSubscribeChan

func (c *InlineCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)

func (*InlineCompleter) Start

func (c *InlineCompleter) Start(ctx context.Context) error

type JobCompleter

type JobCompleter interface {
	startstop.Service

	// 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(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error

	// ResetSubscribeChan resets the subscription channel for the completer. It
	// must only be called when the completer is stopped.
	ResetSubscribeChan(subscribeCh SubscribeChan)
}

JobCompleter is an interface to a service that "completes" jobs by marking them with an appropriate state and any other necessary metadata in the database. It's a generic interface to let us experiment with the speed of a number of implementations, although River will likely always prefer our most optimized one.

type SubscribeChan

type SubscribeChan chan<- []CompleterJobUpdated

type SubscribeFunc

type SubscribeFunc func(update CompleterJobUpdated)

SubscribeFunc will be invoked whenever a job is updated.

Jump to

Keyboard shortcuts

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