mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
vendor: bump k8s dependencies to v0.29.2
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
61
vendor/k8s.io/client-go/util/workqueue/delaying_queue.go
generated
vendored
61
vendor/k8s.io/client-go/util/workqueue/delaying_queue.go
generated
vendored
@ -33,38 +33,81 @@ type DelayingInterface interface {
|
||||
AddAfter(item interface{}, duration time.Duration)
|
||||
}
|
||||
|
||||
// DelayingQueueConfig specifies optional configurations to customize a DelayingInterface.
|
||||
type DelayingQueueConfig struct {
|
||||
// Name for the queue. If unnamed, the metrics will not be registered.
|
||||
Name string
|
||||
|
||||
// MetricsProvider optionally allows specifying a metrics provider to use for the queue
|
||||
// instead of the global provider.
|
||||
MetricsProvider MetricsProvider
|
||||
|
||||
// Clock optionally allows injecting a real or fake clock for testing purposes.
|
||||
Clock clock.WithTicker
|
||||
|
||||
// Queue optionally allows injecting custom queue Interface instead of the default one.
|
||||
Queue Interface
|
||||
}
|
||||
|
||||
// NewDelayingQueue constructs a new workqueue with delayed queuing ability.
|
||||
// NewDelayingQueue does not emit metrics. For use with a MetricsProvider, please use
|
||||
// NewNamedDelayingQueue instead.
|
||||
// NewDelayingQueueWithConfig instead and specify a name.
|
||||
func NewDelayingQueue() DelayingInterface {
|
||||
return NewDelayingQueueWithCustomClock(clock.RealClock{}, "")
|
||||
return NewDelayingQueueWithConfig(DelayingQueueConfig{})
|
||||
}
|
||||
|
||||
// NewDelayingQueueWithConfig constructs a new workqueue with options to
|
||||
// customize different properties.
|
||||
func NewDelayingQueueWithConfig(config DelayingQueueConfig) DelayingInterface {
|
||||
if config.Clock == nil {
|
||||
config.Clock = clock.RealClock{}
|
||||
}
|
||||
|
||||
if config.Queue == nil {
|
||||
config.Queue = NewWithConfig(QueueConfig{
|
||||
Name: config.Name,
|
||||
MetricsProvider: config.MetricsProvider,
|
||||
Clock: config.Clock,
|
||||
})
|
||||
}
|
||||
|
||||
return newDelayingQueue(config.Clock, config.Queue, config.Name, config.MetricsProvider)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return newDelayingQueue(clock.RealClock{}, q, name)
|
||||
return NewDelayingQueueWithConfig(DelayingQueueConfig{
|
||||
Name: name,
|
||||
Queue: q,
|
||||
})
|
||||
}
|
||||
|
||||
// NewNamedDelayingQueue constructs a new named workqueue with delayed queuing ability
|
||||
// NewNamedDelayingQueue constructs a new named workqueue with delayed queuing ability.
|
||||
// Deprecated: Use NewDelayingQueueWithConfig instead.
|
||||
func NewNamedDelayingQueue(name string) DelayingInterface {
|
||||
return NewDelayingQueueWithCustomClock(clock.RealClock{}, name)
|
||||
return NewDelayingQueueWithConfig(DelayingQueueConfig{Name: name})
|
||||
}
|
||||
|
||||
// NewDelayingQueueWithCustomClock constructs a new named workqueue
|
||||
// with ability to inject real or fake clock for testing purposes
|
||||
// with ability to inject real or fake clock for testing purposes.
|
||||
// Deprecated: Use NewDelayingQueueWithConfig instead.
|
||||
func NewDelayingQueueWithCustomClock(clock clock.WithTicker, name string) DelayingInterface {
|
||||
return newDelayingQueue(clock, NewNamed(name), name)
|
||||
return NewDelayingQueueWithConfig(DelayingQueueConfig{
|
||||
Name: name,
|
||||
Clock: clock,
|
||||
})
|
||||
}
|
||||
|
||||
func newDelayingQueue(clock clock.WithTicker, q Interface, name string) *delayingType {
|
||||
func newDelayingQueue(clock clock.WithTicker, q Interface, name string, provider MetricsProvider) *delayingType {
|
||||
ret := &delayingType{
|
||||
Interface: q,
|
||||
clock: clock,
|
||||
heartbeat: clock.NewTicker(maxWait),
|
||||
stopCh: make(chan struct{}),
|
||||
waitingForAddCh: make(chan *waitFor, 1000),
|
||||
metrics: newRetryMetrics(name),
|
||||
metrics: newRetryMetrics(name, provider),
|
||||
}
|
||||
|
||||
go ret.waitingLoop()
|
||||
|
Reference in New Issue
Block a user