Documentation ¶
Overview ¶
Package jobstore is a generated GoMock package.
Index ¶
- Constants
- func NewBadRequestError(message string) bacerrors.Error
- func NewErrEvaluationAlreadyExists(id string) bacerrors.Error
- func NewErrEvaluationNotFound(id string) bacerrors.Error
- func NewErrExecutionAlreadyExists(id string) bacerrors.Error
- func NewErrExecutionAlreadyTerminal(id string, actual models.ExecutionStateType, ...) bacerrors.Error
- func NewErrExecutionNotFound(id string) bacerrors.Error
- func NewErrInvalidExecutionState(id string, actual models.ExecutionStateType, ...) bacerrors.Error
- func NewErrInvalidExecutionVersion(id string, actual, expected uint64) bacerrors.Error
- func NewErrInvalidJobState(id string, actual models.JobStateType, expected models.JobStateType) bacerrors.Error
- func NewErrInvalidJobVersion(id string, actual, expected uint64) bacerrors.Error
- func NewErrJobAlreadyExists(id string) bacerrors.Error
- func NewErrJobAlreadyTerminal(id string, actual models.JobStateType, newState models.JobStateType) bacerrors.Error
- func NewErrJobNotFound(id string) bacerrors.Error
- func NewErrMultipleEvaluationsFound(id string) bacerrors.Error
- func NewErrMultipleExecutionsFound(id string) bacerrors.Error
- func NewErrMultipleJobsFound(id string) bacerrors.Error
- func NewJobStoreError(message string) bacerrors.Error
- type FullChannelBehavior
- type GetExecutionsOptions
- type JobHistoryQuery
- type JobHistoryQueryResponse
- type JobQuery
- type JobQueryResponse
- type MockStore
- func (m *MockStore) AddExecutionHistory(ctx context.Context, jobID, executionID string, events ...models.Event) error
- func (m *MockStore) AddJobHistory(ctx context.Context, jobID string, events ...models.Event) error
- 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) error
- func (m *MockStore) CreateJob(ctx context.Context, j models.Job) 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 JobHistoryQuery) (*JobHistoryQueryResponse, 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) AddExecutionHistory(ctx, jobID, executionID interface{}, events ...interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) AddJobHistory(ctx, jobID interface{}, events ...interface{}) *gomock.Call
- 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 interface{}) *gomock.Call
- func (mr *MockStoreMockRecorder) CreateJob(ctx, j 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 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 ¶
const ( ConflictJobState bacerrors.ErrorCode = "ConflictJobState" MultipleJobsFound bacerrors.ErrorCode = "MultipleJobsFound" MultipleExecutionsFound bacerrors.ErrorCode = "MultipleExecutionsFound" MultipleEvaluationsFound bacerrors.ErrorCode = "MultipleEvaluationsFound" ConflictJobVersion bacerrors.ErrorCode = "ConflictJobVersion" )
const JobStoreComponent = "JobStore"
Variables ¶
This section is empty.
Functions ¶
func NewBadRequestError ¶ added in v1.5.0
func NewErrEvaluationAlreadyExists ¶ added in v1.5.0
func NewErrEvaluationNotFound ¶ added in v1.5.0
func NewErrExecutionAlreadyTerminal ¶
func NewErrExecutionAlreadyTerminal(id string, actual models.ExecutionStateType, newState models.ExecutionStateType) bacerrors.Error
func NewErrExecutionNotFound ¶
func NewErrInvalidExecutionState ¶
func NewErrInvalidExecutionState(id string, actual models.ExecutionStateType, expected ...models.ExecutionStateType) bacerrors.Error
func NewErrInvalidJobState ¶
func NewErrInvalidJobState(id string, actual models.JobStateType, expected models.JobStateType) bacerrors.Error
func NewErrInvalidJobVersion ¶
func NewErrJobAlreadyExists ¶
func NewErrJobAlreadyTerminal ¶
func NewErrJobAlreadyTerminal(id string, actual models.JobStateType, newState models.JobStateType) bacerrors.Error
func NewErrJobNotFound ¶
func NewErrMultipleEvaluationsFound ¶ added in v1.5.0
func NewErrMultipleExecutionsFound ¶ added in v1.5.0
func NewErrMultipleJobsFound ¶ added in v1.5.0
func NewJobStoreError ¶ added in v1.5.0
Types ¶
type FullChannelBehavior ¶ added in v1.3.1
type FullChannelBehavior int
const ( WatcherDrop FullChannelBehavior = iota WatcherDropOldest WatcherBlock )
type GetExecutionsOptions ¶ added in v1.2.2
type JobHistoryQuery ¶ added in v1.5.0
type JobHistoryQueryResponse ¶ added in v1.5.0
type JobHistoryQueryResponse struct { JobHistory []models.JobHistory Offset uint32 NextToken string }
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 uint64 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) AddExecutionHistory ¶ added in v1.5.0
func (m *MockStore) AddExecutionHistory(ctx context.Context, jobID, executionID string, events ...models.Event) error
AddExecutionHistory mocks base method.
func (*MockStore) AddJobHistory ¶ added in v1.5.0
AddJobHistory mocks base method.
func (*MockStore) CreateEvaluation ¶ added in v1.0.4
CreateEvaluation mocks base method.
func (*MockStore) CreateExecution ¶ added in v1.0.4
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 JobHistoryQuery) (*JobHistoryQueryResponse, 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) AddExecutionHistory ¶ added in v1.5.0
func (mr *MockStoreMockRecorder) AddExecutionHistory(ctx, jobID, executionID interface{}, events ...interface{}) *gomock.Call
AddExecutionHistory indicates an expected call of AddExecutionHistory.
func (*MockStoreMockRecorder) AddJobHistory ¶ added in v1.5.0
func (mr *MockStoreMockRecorder) AddJobHistory(ctx, jobID interface{}, events ...interface{}) *gomock.Call
AddJobHistory indicates an expected call of AddJobHistory.
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 interface{}) *gomock.Call
CreateExecution indicates an expected call of CreateExecution.
func (*MockStoreMockRecorder) CreateJob ¶ added in v1.0.4
func (mr *MockStoreMockRecorder) CreateJob(ctx, j 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 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 JobHistoryQuery) (*JobHistoryQueryResponse, error) // CreateJob will create a new job and persist it in the store. CreateJob(ctx context.Context, j models.Job) 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 // AddJobHistory adds a new history entry for the specified job AddJobHistory(ctx context.Context, jobID string, events ...models.Event) error // CreateExecution creates a new execution CreateExecution(ctx context.Context, execution models.Execution) error // UpdateExecution updates the execution state according to the values // within [UpdateExecutionRequest]. UpdateExecution(ctx context.Context, request UpdateExecutionRequest) error // AddExecutionHistory adds a new history entry for the specified execution AddExecutionHistory(ctx context.Context, jobID, executionID string, events ...models.Event) 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 UpdateExecutionRequest struct { ExecutionID string Condition UpdateExecutionCondition NewValues models.Execution }
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 Message string }
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