Documentation ¶
Overview ¶
Package jobstore is a generated GoMock package.
Index ¶
- type Envelope
- type ErrExecutionAlreadyExists
- type ErrExecutionAlreadyTerminal
- type ErrExecutionNotFound
- type ErrInvalidExecutionState
- type ErrInvalidExecutionVersion
- type ErrInvalidJobState
- type ErrInvalidJobVersion
- type ErrJobAlreadyExists
- type ErrJobAlreadyTerminal
- type ErrJobNotFound
- type FullChannelBehavior
- type GetExecutionsOptions
- type JobHistoryFilterOptions
- type JobQuery
- type JobQueryResponse
- type MockStore
- func (m *MockStore) BeginTx(ctx context.Context) (TxContext, error)
- func (m *MockStore) Close(ctx context.Context) error
- func (m *MockStore) CreateEvaluation(ctx context.Context, eval models.Evaluation) error
- func (m *MockStore) CreateExecution(ctx context.Context, execution models.Execution, event models.Event) error
- func (m *MockStore) CreateJob(ctx context.Context, j models.Job, event models.Event) error
- func (m *MockStore) DeleteEvaluation(ctx context.Context, id string) error
- func (m *MockStore) DeleteJob(ctx context.Context, jobID string) error
- func (m *MockStore) EXPECT() *MockStoreMockRecorder
- func (m *MockStore) GetEvaluation(ctx context.Context, id string) (models.Evaluation, error)
- func (m *MockStore) GetExecutions(ctx context.Context, options GetExecutionsOptions) ([]models.Execution, error)
- func (m *MockStore) GetInProgressJobs(ctx context.Context, jobType string) ([]models.Job, error)
- func (m *MockStore) GetJob(ctx context.Context, id string) (models.Job, error)
- func (m *MockStore) GetJobHistory(ctx context.Context, jobID string, options JobHistoryFilterOptions) ([]models.JobHistory, error)
- func (m *MockStore) GetJobs(ctx context.Context, query JobQuery) (*JobQueryResponse, error)
- func (m *MockStore) UpdateExecution(ctx context.Context, request UpdateExecutionRequest) error
- func (m *MockStore) UpdateJobState(ctx context.Context, request UpdateJobStateRequest) error
- func (m *MockStore) Watch(ctx context.Context, types StoreWatcherType, events StoreEventType, ...) *Watcher
- type MockStoreMockRecorder
- func (mr *MockStoreMockRecorder) BeginTx(ctx interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) Close(ctx interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) CreateEvaluation(ctx, eval interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) CreateExecution(ctx, execution, event interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) CreateJob(ctx, j, event interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) DeleteEvaluation(ctx, id interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) DeleteJob(ctx, jobID interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) GetEvaluation(ctx, id interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) GetExecutions(ctx, options interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) GetInProgressJobs(ctx, jobType interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) GetJob(ctx, id interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) GetJobHistory(ctx, jobID, options interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) GetJobs(ctx, query interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) UpdateExecution(ctx, request interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) UpdateJobState(ctx, request interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) Watch(ctx, types, events interface{}, options ...interface{}) *gomock.Call
- type MockTxContext
- func (m *MockTxContext) Commit() error
- func (m *MockTxContext) Deadline() (time.Time, bool)
- func (m *MockTxContext) Done() <-chan struct{}
- func (m *MockTxContext) EXPECT() *MockTxContextMockRecorder
- func (m *MockTxContext) Err() error
- func (m *MockTxContext) Rollback() error
- func (m *MockTxContext) Value(key any) any
- type MockTxContextMockRecorder
- func (mr *MockTxContextMockRecorder) Commit() *gomock.Call
- func (mr *MockTxContextMockRecorder) Deadline() *gomock.Call
- func (mr *MockTxContextMockRecorder) Done() *gomock.Call
- func (mr *MockTxContextMockRecorder) Err() *gomock.Call
- func (mr *MockTxContextMockRecorder) Rollback() *gomock.Call
- func (mr *MockTxContextMockRecorder) Value(key interface{}) *gomock.Call
- type Option
- type Store
- type StoreEventType
- type StoreWatcherType
- type TracingContext
- type TxContext
- type UpdateExecutionCondition
- type UpdateExecutionRequest
- type UpdateJobCondition
- type UpdateJobStateRequest
- type WatchEvent
- type Watcher
- type WatcherOption
- type WatchersManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Envelope ¶ added in v1.0.4
type Envelope[T any] struct { Body T // contains filtered or unexported fields }
Envelope provides a wrapper around types that can be stored in a jobstore. It takes responsibility for the wrapped type, ensuring that
func NewEnvelope ¶ added in v1.0.4
func (*Envelope[T]) Deserialize ¶ added in v1.0.4
type ErrExecutionAlreadyExists ¶
type ErrExecutionAlreadyExists struct {
ExecutionID string
}
ErrExecutionAlreadyExists is returned when an job already exists
func NewErrExecutionAlreadyExists ¶
func NewErrExecutionAlreadyExists(id string) ErrExecutionAlreadyExists
func (ErrExecutionAlreadyExists) Error ¶
func (e ErrExecutionAlreadyExists) Error() string
type ErrExecutionAlreadyTerminal ¶
type ErrExecutionAlreadyTerminal struct { ExecutionID string Actual models.ExecutionStateType NewState models.ExecutionStateType }
ErrExecutionAlreadyTerminal is returned when an execution is already in terminal state and cannot be updated.
func NewErrExecutionAlreadyTerminal ¶
func NewErrExecutionAlreadyTerminal( id string, actual models.ExecutionStateType, newState models.ExecutionStateType) ErrExecutionAlreadyTerminal
func (ErrExecutionAlreadyTerminal) Error ¶
func (e ErrExecutionAlreadyTerminal) Error() string
type ErrExecutionNotFound ¶
type ErrExecutionNotFound struct {
ExecutionID string
}
ErrExecutionNotFound is returned when an job already exists
func NewErrExecutionNotFound ¶
func NewErrExecutionNotFound(id string) ErrExecutionNotFound
func (ErrExecutionNotFound) Error ¶
func (e ErrExecutionNotFound) Error() string
type ErrInvalidExecutionState ¶
type ErrInvalidExecutionState struct { ExecutionID string Actual models.ExecutionStateType Expected []models.ExecutionStateType }
ErrInvalidExecutionState is returned when an execution is in an invalid state.
func NewErrInvalidExecutionState ¶
func NewErrInvalidExecutionState( id string, actual models.ExecutionStateType, expected ...models.ExecutionStateType) ErrInvalidExecutionState
func (ErrInvalidExecutionState) Error ¶
func (e ErrInvalidExecutionState) Error() string
type ErrInvalidExecutionVersion ¶
ErrInvalidExecutionVersion is returned when an execution has an invalid version.
func NewErrInvalidExecutionVersion ¶
func NewErrInvalidExecutionVersion(id string, actual, expected uint64) ErrInvalidExecutionVersion
func (ErrInvalidExecutionVersion) Error ¶
func (e ErrInvalidExecutionVersion) Error() string
type ErrInvalidJobState ¶
type ErrInvalidJobState struct { JobID string Actual models.JobStateType Expected models.JobStateType }
ErrInvalidJobState is returned when an job is in an invalid state.
func NewErrInvalidJobState ¶
func NewErrInvalidJobState(id string, actual models.JobStateType, expected models.JobStateType) ErrInvalidJobState
func (ErrInvalidJobState) Error ¶
func (e ErrInvalidJobState) Error() string
type ErrInvalidJobVersion ¶
ErrInvalidJobVersion is returned when an job has an invalid version.
func NewErrInvalidJobVersion ¶
func NewErrInvalidJobVersion(id string, actual, expected uint64) ErrInvalidJobVersion
func (ErrInvalidJobVersion) Error ¶
func (e ErrInvalidJobVersion) Error() string
type ErrJobAlreadyExists ¶
type ErrJobAlreadyExists struct {
JobID string
}
ErrJobAlreadyExists is returned when an job already exists
func NewErrJobAlreadyExists ¶
func NewErrJobAlreadyExists(id string) ErrJobAlreadyExists
func (ErrJobAlreadyExists) Error ¶
func (e ErrJobAlreadyExists) Error() string
type ErrJobAlreadyTerminal ¶
type ErrJobAlreadyTerminal struct { JobID string Actual models.JobStateType NewState models.JobStateType }
ErrJobAlreadyTerminal is returned when an job is already in terminal state and cannot be updated.
func NewErrJobAlreadyTerminal ¶
func NewErrJobAlreadyTerminal(id string, actual models.JobStateType, newState models.JobStateType) ErrJobAlreadyTerminal
func (ErrJobAlreadyTerminal) Error ¶
func (e ErrJobAlreadyTerminal) Error() string
type ErrJobNotFound ¶
type ErrJobNotFound struct {
JobID string
}
ErrJobNotFound is returned when the job is not found
func NewErrJobNotFound ¶
func NewErrJobNotFound(id string) ErrJobNotFound
func (ErrJobNotFound) Error ¶
func (e ErrJobNotFound) Error() string
type FullChannelBehavior ¶ added in v1.3.1
type FullChannelBehavior int
const ( WatcherDrop FullChannelBehavior = iota WatcherDropOldest WatcherBlock )
type GetExecutionsOptions ¶ added in v1.2.2
type JobHistoryFilterOptions ¶ added in v0.3.26
type JobQuery ¶
type JobQuery struct { Namespace string // IncludeTags and ExcludeTags are used primarily by the requester's list API. // In the orchestrator API, we insted use the Selector field to filter jobs. IncludeTags []string ExcludeTags []string Limit uint32 Offset uint32 ReturnAll bool SortBy string SortReverse bool Selector labels.Selector }
type JobQueryResponse ¶ added in v1.2.2
type MockStore ¶ added in v1.0.4
type MockStore struct {
// contains filtered or unexported fields
}
MockStore is a mock of Store interface.
func NewMockStore ¶ added in v1.0.4
func NewMockStore(ctrl *gomock.Controller) *MockStore
NewMockStore creates a new mock instance.
func (*MockStore) CreateEvaluation ¶ added in v1.0.4
CreateEvaluation mocks base method.
func (*MockStore) CreateExecution ¶ added in v1.0.4
func (m *MockStore) CreateExecution(ctx context.Context, execution models.Execution, event models.Event) error
CreateExecution mocks base method.
func (*MockStore) DeleteEvaluation ¶ added in v1.0.4
DeleteEvaluation mocks base method.
func (*MockStore) EXPECT ¶ added in v1.0.4
func (m *MockStore) EXPECT() *MockStoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockStore) GetEvaluation ¶ added in v1.0.4
GetEvaluation mocks base method.
func (*MockStore) GetExecutions ¶ added in v1.0.4
func (m *MockStore) GetExecutions(ctx context.Context, options GetExecutionsOptions) ([]models.Execution, error)
GetExecutions mocks base method.
func (*MockStore) GetInProgressJobs ¶ added in v1.0.4
GetInProgressJobs mocks base method.
func (*MockStore) GetJobHistory ¶ added in v1.0.4
func (m *MockStore) GetJobHistory(ctx context.Context, jobID string, options JobHistoryFilterOptions) ([]models.JobHistory, error)
GetJobHistory mocks base method.
func (*MockStore) UpdateExecution ¶ added in v1.0.4
func (m *MockStore) UpdateExecution(ctx context.Context, request UpdateExecutionRequest) error
UpdateExecution mocks base method.
func (*MockStore) UpdateJobState ¶ added in v1.0.4
func (m *MockStore) UpdateJobState(ctx context.Context, request UpdateJobStateRequest) error
UpdateJobState mocks base method.
func (*MockStore) Watch ¶ added in v1.0.4
func (m *MockStore) Watch(ctx context.Context, types StoreWatcherType, events StoreEventType, options ...WatcherOption) *Watcher
Watch mocks base method.
type MockStoreMockRecorder ¶ added in v1.0.4
type MockStoreMockRecorder struct {
// contains filtered or unexported fields
}
MockStoreMockRecorder is the mock recorder for MockStore.
func (*MockStoreMockRecorder) BeginTx ¶ added in v1.3.1
func (mr *MockStoreMockRecorder) BeginTx(ctx interface{}) *gomock.Call
BeginTx indicates an expected call of BeginTx.
func (*MockStoreMockRecorder) Close ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) Close(ctx interface{}) *gomock.Call
Close indicates an expected call of Close.
func (*MockStoreMockRecorder) CreateEvaluation ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) CreateEvaluation(ctx, eval interface{}) *gomock.Call
CreateEvaluation indicates an expected call of CreateEvaluation.
func (*MockStoreMockRecorder) CreateExecution ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) CreateExecution(ctx, execution, event interface{}) *gomock.Call
CreateExecution indicates an expected call of CreateExecution.
func (*MockStoreMockRecorder) CreateJob ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) CreateJob(ctx, j, event interface{}) *gomock.Call
CreateJob indicates an expected call of CreateJob.
func (*MockStoreMockRecorder) DeleteEvaluation ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) DeleteEvaluation(ctx, id interface{}) *gomock.Call
DeleteEvaluation indicates an expected call of DeleteEvaluation.
func (*MockStoreMockRecorder) DeleteJob ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) DeleteJob(ctx, jobID interface{}) *gomock.Call
DeleteJob indicates an expected call of DeleteJob.
func (*MockStoreMockRecorder) GetEvaluation ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) GetEvaluation(ctx, id interface{}) *gomock.Call
GetEvaluation indicates an expected call of GetEvaluation.
func (*MockStoreMockRecorder) GetExecutions ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) GetExecutions(ctx, options interface{}) *gomock.Call
GetExecutions indicates an expected call of GetExecutions.
func (*MockStoreMockRecorder) GetInProgressJobs ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) GetInProgressJobs(ctx, jobType interface{}) *gomock.Call
GetInProgressJobs indicates an expected call of GetInProgressJobs.
func (*MockStoreMockRecorder) GetJob ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) GetJob(ctx, id interface{}) *gomock.Call
GetJob indicates an expected call of GetJob.
func (*MockStoreMockRecorder) GetJobHistory ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) GetJobHistory(ctx, jobID, options interface{}) *gomock.Call
GetJobHistory indicates an expected call of GetJobHistory.
func (*MockStoreMockRecorder) GetJobs ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) GetJobs(ctx, query interface{}) *gomock.Call
GetJobs indicates an expected call of GetJobs.
func (*MockStoreMockRecorder) UpdateExecution ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) UpdateExecution(ctx, request interface{}) *gomock.Call
UpdateExecution indicates an expected call of UpdateExecution.
func (*MockStoreMockRecorder) UpdateJobState ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) UpdateJobState(ctx, request interface{}) *gomock.Call
UpdateJobState indicates an expected call of UpdateJobState.
func (*MockStoreMockRecorder) Watch ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) Watch(ctx, types, events interface{}, options ...interface{}) *gomock.Call
Watch indicates an expected call of Watch.
type MockTxContext ¶ added in v1.3.1
type MockTxContext struct {
// contains filtered or unexported fields
}
MockTxContext is a mock of TxContext interface.
func NewMockTxContext ¶ added in v1.3.1
func NewMockTxContext(ctrl *gomock.Controller) *MockTxContext
NewMockTxContext creates a new mock instance.
func (*MockTxContext) Commit ¶ added in v1.3.1
func (m *MockTxContext) Commit() error
Commit mocks base method.
func (*MockTxContext) Deadline ¶ added in v1.3.1
func (m *MockTxContext) Deadline() (time.Time, bool)
Deadline mocks base method.
func (*MockTxContext) Done ¶ added in v1.3.1
func (m *MockTxContext) Done() <-chan struct{}
Done mocks base method.
func (*MockTxContext) EXPECT ¶ added in v1.3.1
func (m *MockTxContext) EXPECT() *MockTxContextMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockTxContext) Err ¶ added in v1.3.1
func (m *MockTxContext) Err() error
Err mocks base method.
func (*MockTxContext) Rollback ¶ added in v1.3.1
func (m *MockTxContext) Rollback() error
Rollback mocks base method.
func (*MockTxContext) Value ¶ added in v1.3.1
func (m *MockTxContext) Value(key any) any
Value mocks base method.
type MockTxContextMockRecorder ¶ added in v1.3.1
type MockTxContextMockRecorder struct {
// contains filtered or unexported fields
}
MockTxContextMockRecorder is the mock recorder for MockTxContext.
func (*MockTxContextMockRecorder) Commit ¶ added in v1.3.1
func (mr *MockTxContextMockRecorder) Commit() *gomock.Call
Commit indicates an expected call of Commit.
func (*MockTxContextMockRecorder) Deadline ¶ added in v1.3.1
func (mr *MockTxContextMockRecorder) Deadline() *gomock.Call
Deadline indicates an expected call of Deadline.
func (*MockTxContextMockRecorder) Done ¶ added in v1.3.1
func (mr *MockTxContextMockRecorder) Done() *gomock.Call
Done indicates an expected call of Done.
func (*MockTxContextMockRecorder) Err ¶ added in v1.3.1
func (mr *MockTxContextMockRecorder) Err() *gomock.Call
Err indicates an expected call of Err.
func (*MockTxContextMockRecorder) Rollback ¶ added in v1.3.1
func (mr *MockTxContextMockRecorder) Rollback() *gomock.Call
Rollback indicates an expected call of Rollback.
func (*MockTxContextMockRecorder) Value ¶ added in v1.3.1
func (mr *MockTxContextMockRecorder) Value(key interface{}) *gomock.Call
Value indicates an expected call of Value.
type Option ¶ added in v1.0.4
func WithMarshaller ¶ added in v1.0.4
func WithMarshaller[T any](marshaller marshaller.Marshaller) Option[T]
type Store ¶
type Store interface { // BeginTx starts a new transaction and returns a transactional context BeginTx(ctx context.Context) (TxContext, error) // Watch returns a channel from which the caller can read specific events // as they are transmitted. When called the combination of parameters // will determine which events are sent. Both the StoreWatcherType and // StoreEventType parameters can be a bitmask of entries, so to listen // for Create and Delete events for Jobs and Executions you would set // types = JobWatcher | ExecutionWatcher // events = CreateEvent | DeleteEvent // // The structure sent down the channel when one of these events occurs // will contain a timestamp, but also the StoreWatcherType and // StoreEventType that triggered the event. A json encoded `[]byte` // of the related object will also be included in the [WatchEvent]. Watch(ctx context.Context, types StoreWatcherType, events StoreEventType, options ...WatcherOption) *Watcher // GetJob returns a job, identified by the id parameter, or an error if // it does not exist. GetJob(ctx context.Context, id string) (models.Job, error) // GetJobs retrieves a slice of jobs defined by the contents of the // [JobQuery]. If it fails, it will return an error GetJobs(ctx context.Context, query JobQuery) (*JobQueryResponse, error) // GetInProgressJobs retrieves all jobs that have a state that can be // considered, 'in progress'. Failure generates an error. If the jobType // is provided, only active jobs of that type will be returned. GetInProgressJobs(ctx context.Context, jobType string) ([]models.Job, error) // GetJobHistory retrieves the history for the specified job. The // history returned is filtered by the contents of the provided // [JobHistoryFilterOptions]. GetJobHistory(ctx context.Context, jobID string, options JobHistoryFilterOptions) ([]models.JobHistory, error) // CreateJob will create a new job and persist it in the store. CreateJob(ctx context.Context, j models.Job, event models.Event) error // GetExecutions retrieves all executions for the specified job. GetExecutions(ctx context.Context, options GetExecutionsOptions) ([]models.Execution, error) // UpdateJobState updates the state for the job identified in the // [UpdateJobStateRequest]. UpdateJobState(ctx context.Context, request UpdateJobStateRequest) error // CreateExecution creates a new execution CreateExecution(ctx context.Context, execution models.Execution, event models.Event) error // UpdateExecution updates the execution state according to the values // within [UpdateExecutionRequest]. UpdateExecution(ctx context.Context, request UpdateExecutionRequest) error // DeleteJob removes all trace of the provided job from storage DeleteJob(ctx context.Context, jobID string) error // CreateEvaluation creates a new evaluation CreateEvaluation(ctx context.Context, eval models.Evaluation) error // GetEvaluation retrieves the specified evaluation GetEvaluation(ctx context.Context, id string) (models.Evaluation, error) // DeleteEvaluation deletes the specified evaluation DeleteEvaluation(ctx context.Context, id string) error // Close provides an interface to cleanup any resources in use when the // store is no longer required Close(ctx context.Context) error }
A Store will persist jobs and their state to the underlying storage. It also gives an efficient way to retrieve jobs using queries.
type StoreEventType ¶ added in v1.0.4
type StoreEventType int
const ( CreateEvent StoreEventType = 1 << iota UpdateEvent DeleteEvent )
func (StoreEventType) String ¶ added in v1.0.4
func (s StoreEventType) String() string
type StoreWatcherType ¶ added in v1.0.4
type StoreWatcherType int
const ( JobWatcher StoreWatcherType = 1 << iota ExecutionWatcher EvaluationWatcher )
func (StoreWatcherType) String ¶ added in v1.0.4
func (s StoreWatcherType) String() string
type TracingContext ¶ added in v1.3.1
type TracingContext struct { TxContext // contains filtered or unexported fields }
TracingContext is a context that can be used to trace the duration of a transaction and log a debug message if it exceeds a certain threshold.
func NewTracingContext ¶ added in v1.3.1
func NewTracingContext(ctx TxContext) *TracingContext
NewTracingContext creates a new tracing context
func (TracingContext) Commit ¶ added in v1.3.1
func (t TracingContext) Commit() error
func (TracingContext) Rollback ¶ added in v1.3.1
func (t TracingContext) Rollback() error
type TxContext ¶ added in v1.3.1
TxContext is a transactional context that can be used to commit or rollback
type UpdateExecutionCondition ¶
type UpdateExecutionCondition struct { ExpectedStates []models.ExecutionStateType ExpectedRevision uint64 UnexpectedStates []models.ExecutionStateType }
type UpdateExecutionRequest ¶
type UpdateJobCondition ¶
type UpdateJobCondition struct { ExpectedState models.JobStateType UnexpectedStates []models.JobStateType ExpectedRevision uint64 }
type UpdateJobStateRequest ¶
type UpdateJobStateRequest struct { JobID string Condition UpdateJobCondition NewState models.JobStateType Event models.Event }
type WatchEvent ¶ added in v1.0.4
type WatchEvent struct { Kind StoreWatcherType Event StoreEventType Object any Timestamp int64 }
WatchEvent is the message passed through the watcher whenever a specific event occurs on a specific type, as requested when creating the watcher.
func NewWatchEvent ¶ added in v1.0.4
func NewWatchEvent(kind StoreWatcherType, event StoreEventType, object any) *WatchEvent
type Watcher ¶ added in v1.0.4
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is used by the jobstore to keep a record of parties interested in events happening in the jobstore. This allows for watching of job and execution types (or both), and for create, update and delete events (or any combination).
func NewWatcher ¶ added in v1.0.4
func NewWatcher(ctx context.Context, types StoreWatcherType, events StoreEventType, options ...WatcherOption) *Watcher
func (*Watcher) Channel ¶ added in v1.0.4
func (w *Watcher) Channel() chan *WatchEvent
func (*Watcher) IsWatchingEvent ¶ added in v1.0.4
func (w *Watcher) IsWatchingEvent(event StoreEventType) bool
func (*Watcher) IsWatchingType ¶ added in v1.0.4
func (w *Watcher) IsWatchingType(kind StoreWatcherType) bool
type WatcherOption ¶ added in v1.3.1
type WatcherOption func(*Watcher)
func WithChannelSize ¶ added in v1.3.1
func WithChannelSize(size int) WatcherOption
func WithFullChannelBehavior ¶ added in v1.3.1
func WithFullChannelBehavior(behavior FullChannelBehavior) WatcherOption
type WatchersManager ¶ added in v1.3.1
type WatchersManager struct {
// contains filtered or unexported fields
}
WatchersManager is a helper type that can be used by the different jobstore implementations to manage watchers. It allows for the creation of new watchers, the writing of events to all interested watchers and the cleanup of closed watchers.
func NewWatchersManager ¶ added in v1.3.1
func NewWatchersManager() *WatchersManager
func (*WatchersManager) Close ¶ added in v1.3.1
func (w *WatchersManager) Close()
Close closes all watchers
func (*WatchersManager) NewWatcher ¶ added in v1.3.1
func (w *WatchersManager) NewWatcher( ctx context.Context, types StoreWatcherType, events StoreEventType, options ...WatcherOption) *Watcher
NewWatcher creates a new Watcher managed by the WatchersManager
func (*WatchersManager) Write ¶ added in v1.3.1
func (w *WatchersManager) Write(kind StoreWatcherType, event StoreEventType, object any)
Write writes an event to all interested watchers If a watcher is closed, it is removed from the list of watchers