type DelayingInterface … type TypedDelayingInterface … type DelayingQueueConfig … type TypedDelayingQueueConfig … // NewDelayingQueue constructs a new workqueue with delayed queuing ability. // NewDelayingQueue does not emit metrics. For use with a MetricsProvider, please use // NewDelayingQueueWithConfig instead and specify a name. // // Deprecated: use NewTypedDelayingQueue instead. func NewDelayingQueue() DelayingInterface { … } // NewTypedDelayingQueue constructs a new workqueue with delayed queuing ability. // NewTypedDelayingQueue does not emit metrics. For use with a MetricsProvider, please use // NewTypedDelayingQueueWithConfig instead and specify a name. func NewTypedDelayingQueue[T comparable]() TypedDelayingInterface[T] { … } // NewDelayingQueueWithConfig constructs a new workqueue with options to // customize different properties. // // Deprecated: use NewTypedDelayingQueueWithConfig instead. func NewDelayingQueueWithConfig(config DelayingQueueConfig) DelayingInterface { … } // TypedNewDelayingQueue exists for backwards compatibility only. // // Deprecated: use NewTypedDelayingQueueWithConfig instead. func TypedNewDelayingQueue[T comparable]() TypedDelayingInterface[T] { … } // NewTypedDelayingQueueWithConfig constructs a new workqueue with options to // customize different properties. func NewTypedDelayingQueueWithConfig[T comparable](config TypedDelayingQueueConfig[T]) TypedDelayingInterface[T] { … } // NewDelayingQueueWithCustomQueue constructs a new workqueue with ability to // inject custom queue Interface instead of the default one // Deprecated: Use NewDelayingQueueWithConfig instead. func NewDelayingQueueWithCustomQueue(q Interface, name string) DelayingInterface { … } // NewNamedDelayingQueue constructs a new named workqueue with delayed queuing ability. // Deprecated: Use NewDelayingQueueWithConfig instead. func NewNamedDelayingQueue(name string) DelayingInterface { … } // NewDelayingQueueWithCustomClock constructs a new named workqueue // with ability to inject real or fake clock for testing purposes. // Deprecated: Use NewDelayingQueueWithConfig instead. func NewDelayingQueueWithCustomClock(clock clock.WithTicker, name string) DelayingInterface { … } func newDelayingQueue[T comparable](clock clock.WithTicker, q TypedInterface[T], name string, provider MetricsProvider) *delayingType[T] { … } type delayingType … type waitFor … type waitForPriorityQueue … func (pq waitForPriorityQueue[T]) Len() int { … } func (pq waitForPriorityQueue[T]) Less(i, j int) bool { … } func (pq waitForPriorityQueue[T]) Swap(i, j int) { … } // Push adds an item to the queue. Push should not be called directly; instead, // use `heap.Push`. func (pq *waitForPriorityQueue[T]) Push(x interface{ … } // Pop removes an item from the queue. Pop should not be called directly; // instead, use `heap.Pop`. func (pq *waitForPriorityQueue[T]) Pop() interface{ … } // Peek returns the item at the beginning of the queue, without removing the // item or otherwise mutating the queue. It is safe to call directly. func (pq waitForPriorityQueue[T]) Peek() interface{ … } // ShutDown stops the queue. After the queue drains, the returned shutdown bool // on Get() will be true. This method may be invoked more than once. func (q *delayingType[T]) ShutDown() { … } // AddAfter adds the given item to the work queue after the given delay func (q *delayingType[T]) AddAfter(item T, duration time.Duration) { … } const maxWait … // waitingLoop runs until the workqueue is shutdown and keeps a check on the list of items to be added. func (q *delayingType[T]) waitingLoop() { … } // insert adds the entry to the priority queue, or updates the readyAt if it already exists in the queue func insert[T comparable](q *waitForPriorityQueue[T], knownEntries map[T]*waitFor[T], entry *waitFor[T]) { … }