Documentation ¶
Index ¶
- type AsyncCompleter
- type BatchCompleter
- func (c *BatchCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, ...) error
- func (c *BatchCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)
- func (c *BatchCompleter) Start(ctx context.Context) error
- func (c *BatchCompleter) Stop()
- func (c *BatchCompleter) WaitStarted() <-chan struct{}
- type CompleterJobUpdated
- type InlineCompleter
- type JobCompleter
- type PartialExecutor
- type SubscribeChan
- type SubscribeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncCompleter ¶ added in v0.1.0
type AsyncCompleter struct { baseservice.BaseService startstop.BaseStartStop // contains filtered or unexported fields }
func NewAsyncCompleter ¶
func NewAsyncCompleter(archetype *baseservice.Archetype, exec PartialExecutor, subscribeCh SubscribeChan) *AsyncCompleter
func (*AsyncCompleter) JobSetStateIfRunning ¶ added in v0.1.0
func (c *AsyncCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error
func (*AsyncCompleter) ResetSubscribeChan ¶ added in v0.7.0
func (c *AsyncCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)
type BatchCompleter ¶ added in v0.1.0
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 ¶ added in v0.1.0
func NewBatchCompleter(archetype *baseservice.Archetype, exec PartialExecutor, subscribeCh SubscribeChan) *BatchCompleter
func (*BatchCompleter) JobSetStateIfRunning ¶ added in v0.1.0
func (c *BatchCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error
func (*BatchCompleter) ResetSubscribeChan ¶ added in v0.7.0
func (c *BatchCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)
func (*BatchCompleter) Start ¶ added in v0.1.0
func (c *BatchCompleter) Start(ctx context.Context) error
func (*BatchCompleter) Stop ¶ added in v0.1.0
func (c *BatchCompleter) Stop()
func (*BatchCompleter) WaitStarted ¶ added in v0.1.0
func (c *BatchCompleter) WaitStarted() <-chan struct{}
type CompleterJobUpdated ¶
type CompleterJobUpdated struct { Job *rivertype.JobRow JobStats *jobstats.JobStatistics }
type InlineCompleter ¶ added in v0.1.0
type InlineCompleter struct { baseservice.BaseService startstop.BaseStartStop // contains filtered or unexported fields }
func NewInlineCompleter ¶
func NewInlineCompleter(archetype *baseservice.Archetype, exec PartialExecutor, subscribeCh SubscribeChan) *InlineCompleter
func (*InlineCompleter) JobSetStateIfRunning ¶ added in v0.1.0
func (c *InlineCompleter) JobSetStateIfRunning(ctx context.Context, stats *jobstats.JobStatistics, params *riverdriver.JobSetStateIfRunningParams) error
func (*InlineCompleter) ResetSubscribeChan ¶ added in v0.7.0
func (c *InlineCompleter) ResetSubscribeChan(subscribeCh SubscribeChan)
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 PartialExecutor ¶ added in v0.0.23
type PartialExecutor interface { JobSetCompleteIfRunningMany(ctx context.Context, params *riverdriver.JobSetCompleteIfRunningManyParams) ([]*rivertype.JobRow, error) 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.
type SubscribeChan ¶ added in v0.7.0
type SubscribeChan chan<- []CompleterJobUpdated
type SubscribeFunc ¶ added in v0.7.0
type SubscribeFunc func(update CompleterJobUpdated)
SubscribeFunc will be invoked whenever a job is updated.