Documentation ¶
Index ¶
- Constants
- type HandleResult
- type Handler
- type Queue
- func (q *Queue) Enqueue(obj interface{})
- func (q *Queue) EnqueueAfter(obj interface{}, after time.Duration)
- func (q *Queue) EnqueueRateLimited(obj interface{})
- func (q *Queue) IsShuttingDown() bool
- func (q *Queue) Len() int
- func (q *Queue) Queue() workqueue.RateLimitingInterface
- func (q *Queue) Run(workers int)
- func (q *Queue) SetMaxErrRetries(max int) *Queue
- func (q *Queue) ShutDown()
Constants ¶
const ( ErrRetryForever = -1 ErrRetryNone = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandleResult ¶
type HandleResult struct { // RequeueRateLimited re-enqueue the object after the rate limiter says it's ok. Defaults to false. RequeueRateLimited bool // RequeueImmediately tells the Queue to requeue the object immediately. Defaults to false. RequeueImmediately bool // RequeueAfter tells the Queue to re-enqueue the object after the Duration if it is greater than 0. RequeueAfter time.Duration // MaxRequeueTimes tells the Queue the limit count of requeueing object. Defaults to 1. // If you want to requeue forever, please use set it to MaxErrRetryForever MaxRequeueTimes int }
type Handler ¶
type Handler func(obj interface{}) (HandleResult, error)
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a wrapper of kubernetes workqueue to do asynchronous work easily. It requires a Handler and an optional key function. After starting the Queue, you can call the Enqueque function to enqueue items. Queue will get key from the items by keyFunc, and add the key to the rate limit workqueue. The worker will be invoked to call the Handler.
func (*Queue) EnqueueAfter ¶
EnqueueAfter wraps queue.AddAfter. It adds an item to the workqueue after the indicated duration has passed
func (*Queue) EnqueueRateLimited ¶
func (q *Queue) EnqueueRateLimited(obj interface{})
EnqueueRateLimited wraps queue.AddRateLimited. It adds an item to the workqueue after the rate limiter says its ok
func (*Queue) IsShuttingDown ¶
IsShuttingDown returns if the method Shutdown was invoked
func (*Queue) Queue ¶
func (q *Queue) Queue() workqueue.RateLimitingInterface
Queue returns the rate limit work queue
func (*Queue) SetMaxErrRetries ¶
SetMaxRetries sets the max retry times of the queue