Documentation
¶
Overview ¶
Package taskqueue provides a task queue for syncing objects in parallel.
Index ¶
- Variables
- type PeriodicTaskQueueWithMultipleWorkers
- func (t *PeriodicTaskQueueWithMultipleWorkers) Enqueue(objs ...any)
- func (t *PeriodicTaskQueueWithMultipleWorkers) Len() int
- func (t *PeriodicTaskQueueWithMultipleWorkers) NumRequeues(obj any) int
- func (t *PeriodicTaskQueueWithMultipleWorkers) Run()
- func (t *PeriodicTaskQueueWithMultipleWorkers) Shutdown()
- func (t *PeriodicTaskQueueWithMultipleWorkers) ShuttingDown() bool
- type TaskQueue
Constants ¶
This section is empty.
Variables ¶
var ( // KeyFunc is the default key function for the task queue. // It uses the cache.DeletionHandlingMetaNamespaceKeyFunc, which is the same as the default // key function for the k8s workqueue. KeyFunc = cache.DeletionHandlingMetaNamespaceKeyFunc )
Functions ¶
This section is empty.
Types ¶
type PeriodicTaskQueueWithMultipleWorkers ¶
type PeriodicTaskQueueWithMultipleWorkers struct {
// contains filtered or unexported fields
}
PeriodicTaskQueueWithMultipleWorkers invokes the given sync function for every work item inserted, while running n parallel worker routines. If the sync() function results in an error, the item is put on the work queue after a rate-limit.
func NewPeriodicTaskQueueWithMultipleWorkers ¶
func NewPeriodicTaskQueueWithMultipleWorkers(name, resource string, numWorkers int, syncFn func(context.Context, string) error) *PeriodicTaskQueueWithMultipleWorkers
NewPeriodicTaskQueueWithMultipleWorkers creates a new task queue with the default rate limiter and the given number of worker goroutines.
func (*PeriodicTaskQueueWithMultipleWorkers) Enqueue ¶
func (t *PeriodicTaskQueueWithMultipleWorkers) Enqueue(objs ...any)
Enqueue adds one or more keys to the work queue.
func (*PeriodicTaskQueueWithMultipleWorkers) Len ¶
func (t *PeriodicTaskQueueWithMultipleWorkers) Len() int
Len returns the length of the queue.
func (*PeriodicTaskQueueWithMultipleWorkers) NumRequeues ¶
func (t *PeriodicTaskQueueWithMultipleWorkers) NumRequeues(obj any) int
NumRequeues returns the number of times the given item was requeued.
func (*PeriodicTaskQueueWithMultipleWorkers) Run ¶
func (t *PeriodicTaskQueueWithMultipleWorkers) Run()
Run spawns off n parallel worker routines and returns immediately.
func (*PeriodicTaskQueueWithMultipleWorkers) Shutdown ¶
func (t *PeriodicTaskQueueWithMultipleWorkers) Shutdown()
Shutdown shuts down the work queue and waits for all the workers to ACK
func (*PeriodicTaskQueueWithMultipleWorkers) ShuttingDown ¶
func (t *PeriodicTaskQueueWithMultipleWorkers) ShuttingDown() bool
ShuttingDown returns true if the queue is shutting down.
type TaskQueue ¶
type TaskQueue interface {
// Run starts the task queue.
Run()
// Enqueue adds one or more keys to the work queue.
Enqueue(objs ...any)
// Shutdown shuts down the work queue and waits for all the workers to ACK.
Shutdown()
// Len returns the length of the queue.
Len() int
// NumRequeues returns the number of times the given item was requeued.
NumRequeues(obj any) int
// ShuttingDown returns true if the queue is shutting down.
ShuttingDown() bool
}
TaskQueue is a rate limited operation queue.