Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWorkerError ¶
func NewWorkerError(workerName string) *workerError
Types ¶
type BaseWorker ¶
type BaseWorker struct {
Queue workqueue.TypedRateLimitingInterface[Operand]
WorkerName string
WorkerError WorkerError
Env string
// contains filtered or unexported fields
}
BaseWorker implements generic functionalities for a worker. Actual workers types are supposed to embed this type in them.
func NewBaseWorker ¶
func NewBaseWorker(workerName string, env string) BaseWorker
func (*BaseWorker) EnqueueAfter ¶
func (w *BaseWorker) EnqueueAfter(operand Operand, after time.Duration)
Clients call this method to enqueue a worker after the passed duration.
func (*BaseWorker) EnqueueNow ¶
func (w *BaseWorker) EnqueueNow(operand Operand)
Clients call this method to enqueue work to a worker immeadiately.
func (*BaseWorker) Logger ¶
func (w *BaseWorker) Logger() logger.Logger
func (*BaseWorker) Name ¶
func (w *BaseWorker) Name() string
func (*BaseWorker) WorkQueue ¶
func (w *BaseWorker) WorkQueue() workqueue.TypedRateLimitingInterface[Operand]
type PeriodicReconcilable ¶
If a worker implements PeriodicReconcilable, the worker manager would run enqueue GetInput()'s result to the worker's work queue every Interval().
type Result ¶
type Result struct {
Requeue bool
// RequeueAfter if greater than 0, tells the worker manager to requeue the operand after the Duration.
// Implies that Requeue is true, there is no need to set Requeue to true at the same time as RequeueAfter.
RequeueAfter time.Duration
}
Result contains the result of a worker's Execute invocation.
type Worker ¶
type Worker interface {
Execute(ctx context.Context, operand Operand) (Result, *errors.ServiceError)
EnqueueNow(operand Operand)
EnqueueAfter(Operand Operand, after time.Duration)
WorkQueue() workqueue.TypedRateLimitingInterface[Operand]
// Function that returns the list of operands to be passed to the workers execute method.
GetInput(context.Context) ([]Operand, *errors.ServiceError)
Logger() logger.Logger
Name() string
}
Workers both run periodically at `Interval()` and when clients call `EnqueueNow()`.
type WorkerError ¶
type WorkerError interface {
NewError(format string, args ...any) *errors.ServiceError
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package release is a generated GoMock package.
|
Package release is a generated GoMock package. |
|
Package stack is a generated GoMock package.
|
Package stack is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.