activejobstore

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PanicOnInvariantViolation bool
)

Functions

This section is empty.

Types

type EventHandler

type EventHandler interface {
	OnUpdate(oldRj, newRj *execution.Job)
	OnDelete(rj *execution.Job)
}

type Factory

type Factory struct{}

func NewFactory

func NewFactory() *Factory

func (*Factory) Name

func (f *Factory) Name() string

func (*Factory) New

type InformerWorker

type InformerWorker struct {
	controllercontext.Context
	// contains filtered or unexported fields
}

InformerWorker is used by the store internally to receive updates to the central store.

We only listen to Update and Delete events. This is because any additions are expected to be done explicitly.

It is acceptable for Update and Delete events to be delayed (but not missed).

func NewInformerWorker

func NewInformerWorker(ctrlContext controllercontext.Context, handler EventHandler) *InformerWorker

func (*InformerWorker) HasSynced

func (w *InformerWorker) HasSynced() bool

func (*InformerWorker) OnAdd

func (w *InformerWorker) OnAdd(obj interface{})

func (*InformerWorker) OnDelete

func (w *InformerWorker) OnDelete(obj interface{})

func (*InformerWorker) OnUpdate

func (w *InformerWorker) OnUpdate(oldObj, newObj interface{})

func (*InformerWorker) Start

func (w *InformerWorker) Start(stopCh <-chan struct{})

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is an in-memory store of active Job counts per JobConfig.

This store is expected to be recovered prior to starting the controller, and helps to guard against multiple concurrent jobs for the same JobConfig from being started in an atomic fashion.

func NewStore

func NewStore(ctrlContext controllercontext.Context) (*Store, error)

func (*Store) CheckAndAdd

func (s *Store) CheckAndAdd(rjc *execution.JobConfig, oldCount int64) bool

CheckAndAdd atomically increments the active count for the given JobConfig.

func (*Store) CountActiveJobsForConfig

func (s *Store) CountActiveJobsForConfig(rjc *execution.JobConfig) int64

CountActiveJobsForConfig returns the count of active Jobs for a JobConfig.

func (*Store) Delete

func (s *Store) Delete(rjc *execution.JobConfig)

Delete the Job from the store.

func (*Store) Name

func (s *Store) Name() string

func (*Store) OnDelete

func (s *Store) OnDelete(rj *execution.Job)

func (*Store) OnUpdate

func (s *Store) OnUpdate(oldRj, newRj *execution.Job)

func (*Store) Recover

func (s *Store) Recover(ctx context.Context) error

Recover should be called after the context is started and should be called only once.

Jump to

Keyboard shortcuts

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