mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-28 14:41:10 +01:00
bump to official kubernetes v0.32.0 deps
Signed-off-by: Amir Alavi <amiralavi7@gmail.com>
This commit is contained in:
25
vendor/k8s.io/utils/clock/testing/fake_clock.go
generated
vendored
25
vendor/k8s.io/utils/clock/testing/fake_clock.go
generated
vendored
@@ -48,7 +48,6 @@ type fakeClockWaiter struct {
|
||||
stepInterval time.Duration
|
||||
skipIfBlocked bool
|
||||
destChan chan time.Time
|
||||
fired bool
|
||||
afterFunc func()
|
||||
}
|
||||
|
||||
@@ -198,12 +197,10 @@ func (f *FakeClock) setTimeLocked(t time.Time) {
|
||||
if w.skipIfBlocked {
|
||||
select {
|
||||
case w.destChan <- t:
|
||||
w.fired = true
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
w.destChan <- t
|
||||
w.fired = true
|
||||
}
|
||||
|
||||
if w.afterFunc != nil {
|
||||
@@ -305,44 +302,48 @@ func (f *fakeTimer) C() <-chan time.Time {
|
||||
return f.waiter.destChan
|
||||
}
|
||||
|
||||
// Stop stops the timer and returns true if the timer has not yet fired, or false otherwise.
|
||||
// Stop prevents the Timer from firing. It returns true if the call stops the
|
||||
// timer, false if the timer has already expired or been stopped.
|
||||
func (f *fakeTimer) Stop() bool {
|
||||
f.fakeClock.lock.Lock()
|
||||
defer f.fakeClock.lock.Unlock()
|
||||
|
||||
active := false
|
||||
newWaiters := make([]*fakeClockWaiter, 0, len(f.fakeClock.waiters))
|
||||
for i := range f.fakeClock.waiters {
|
||||
w := f.fakeClock.waiters[i]
|
||||
if w != &f.waiter {
|
||||
newWaiters = append(newWaiters, w)
|
||||
continue
|
||||
}
|
||||
// If timer is found, it has not been fired yet.
|
||||
active = true
|
||||
}
|
||||
|
||||
f.fakeClock.waiters = newWaiters
|
||||
|
||||
return !f.waiter.fired
|
||||
return active
|
||||
}
|
||||
|
||||
// Reset resets the timer to the fake clock's "now" + d. It returns true if the timer has not yet
|
||||
// fired, or false otherwise.
|
||||
// Reset changes the timer to expire after duration d. It returns true if the
|
||||
// timer had been active, false if the timer had expired or been stopped.
|
||||
func (f *fakeTimer) Reset(d time.Duration) bool {
|
||||
f.fakeClock.lock.Lock()
|
||||
defer f.fakeClock.lock.Unlock()
|
||||
|
||||
active := !f.waiter.fired
|
||||
active := false
|
||||
|
||||
f.waiter.fired = false
|
||||
f.waiter.targetTime = f.fakeClock.time.Add(d)
|
||||
|
||||
var isWaiting bool
|
||||
for i := range f.fakeClock.waiters {
|
||||
w := f.fakeClock.waiters[i]
|
||||
if w == &f.waiter {
|
||||
isWaiting = true
|
||||
// If timer is found, it has not been fired yet.
|
||||
active = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !isWaiting {
|
||||
if !active {
|
||||
f.fakeClock.waiters = append(f.fakeClock.waiters, &f.waiter)
|
||||
}
|
||||
|
||||
|
||||
2
vendor/k8s.io/utils/lru/lru.go
generated
vendored
2
vendor/k8s.io/utils/lru/lru.go
generated
vendored
@@ -47,6 +47,8 @@ func NewWithEvictionFunc(size int, f EvictionFunc) *Cache {
|
||||
|
||||
// SetEvictionFunc updates the eviction func
|
||||
func (c *Cache) SetEvictionFunc(f EvictionFunc) error {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
if c.cache.OnEvicted != nil {
|
||||
return fmt.Errorf("lru cache eviction function is already set")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user