Documentation ¶
Overview ¶
package workqueue is a amended copy of k8s' workqueue implementation
Changes made: - workqueue.go - Added MaxSize field to default workqueue. - workqueue.go - Added bool return value whether value was added. - workqueue.go - Added Identifier interface to allow items in workqueue to deviate from the associated ID. - workqueue.go - Added Replace field to allow subsequent Adds of the same ID to simply replace the value. - delaying_queue.go - added non-blocking TryAddAfter. - all - Replaced t and set types with interface{} and map[interface{}]interface{}
upstream source: https://github.com/kubernetes/client-go/tree/master/util/workqueue
Index ¶
Constants ¶
const (
DefaultMaxSize = 10000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DelayingInterface ¶
type DelayingInterface interface { Interface // AddAfter adds an item to the workqueue after the indicated duration has passed AddAfter(item interface{}, duration time.Duration) TryAddAfter(item interface{}, duration time.Duration) bool }
DelayingInterface is an Interface that can Add an item at a later time. This makes it easier to requeue items after failures without ending up in a hot-loop.
func NewDelayingQueue ¶
func NewDelayingQueue(maxSize int) DelayingInterface
NewDelayingQueue constructs a new workqueue with delayed queuing ability
func NewNamedDelayingQueue ¶
func NewNamedDelayingQueue(name string) DelayingInterface
type Identifier ¶
type Identifier interface {
ID() interface{}
}
type Type ¶
Type is a work queue (see the package comment).
func NewWorkQueue ¶
func (*Type) Done ¶
func (q *Type) Done(item interface{})
Done marks item as done processing, and if it has been marked as dirty again while it was being processed, it will be re-added to the queue for re-processing.
func (*Type) Get ¶
Get blocks until it can return an item to be processed. If shutdown = true, the caller should end their goroutine. You must call Done with item when you have finished processing it.
func (*Type) Len ¶
Len returns the current queue length, for informational purposes only. You shouldn't e.g. gate a call to Add() or Get() on Len() being a particular value, that can't be synchronized properly.
func (*Type) ShutDown ¶
func (q *Type) ShutDown()
ShutDown will cause q to ignore all new items added to it. As soon as the worker goroutines have drained the existing items in the queue, they will be instructed to exit.