run hack/{pind-dependency.sh, update-vendor.sh}

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
This commit is contained in:
Madhav Jivrajani
2021-09-30 19:15:35 +05:30
parent 38746752af
commit a43fca76ea
45 changed files with 120 additions and 74 deletions

17
vendor/k8s.io/utils/clock/clock.go generated vendored
View File

@@ -53,6 +53,16 @@ type WithTicker interface {
NewTicker(time.Duration) Ticker
}
// WithDelayedExecution allows for injecting fake or real clocks into
// code that needs to make use of AfterFunc functionality.
type WithDelayedExecution interface {
Clock
// AfterFunc executes f in its own goroutine after waiting
// for d duration and returns a Timer whose channel can be
// closed by calling Stop() on the Timer.
AfterFunc(d time.Duration, f func()) Timer
}
// Ticker defines the Ticker interface.
type Ticker interface {
C() <-chan time.Time
@@ -88,6 +98,13 @@ func (RealClock) NewTimer(d time.Duration) Timer {
}
}
// AfterFunc is the same as time.AfterFunc(d, f).
func (RealClock) AfterFunc(d time.Duration, f func()) Timer {
return &realTimer{
timer: time.AfterFunc(d, f),
}
}
// Tick is the same as time.Tick(d)
// This method does not allow to free/GC the backing ticker. Use
// NewTicker instead.

View File

@@ -49,6 +49,7 @@ type fakeClockWaiter struct {
skipIfBlocked bool
destChan chan time.Time
fired bool
afterFunc func()
}
// NewFakePassiveClock returns a new FakePassiveClock.
@@ -116,6 +117,25 @@ func (f *FakeClock) NewTimer(d time.Duration) clock.Timer {
return timer
}
// AfterFunc is the Fake version of time.AfterFunc(d, cb).
func (f *FakeClock) AfterFunc(d time.Duration, cb func()) clock.Timer {
f.lock.Lock()
defer f.lock.Unlock()
stopTime := f.time.Add(d)
ch := make(chan time.Time, 1) // Don't block!
timer := &fakeTimer{
fakeClock: f,
waiter: fakeClockWaiter{
targetTime: stopTime,
destChan: ch,
afterFunc: cb,
},
}
f.waiters = append(f.waiters, &timer.waiter)
return timer
}
// Tick constructs a fake ticker, akin to time.Tick
func (f *FakeClock) Tick(d time.Duration) <-chan time.Time {
if d <= 0 {
@@ -175,7 +195,6 @@ func (f *FakeClock) setTimeLocked(t time.Time) {
for i := range f.waiters {
w := f.waiters[i]
if !w.targetTime.After(t) {
if w.skipIfBlocked {
select {
case w.destChan <- t:
@@ -187,6 +206,10 @@ func (f *FakeClock) setTimeLocked(t time.Time) {
w.fired = true
}
if w.afterFunc != nil {
w.afterFunc()
}
if w.stepInterval > 0 {
for !w.targetTime.After(t) {
w.targetTime = w.targetTime.Add(w.stepInterval)
@@ -201,7 +224,7 @@ func (f *FakeClock) setTimeLocked(t time.Time) {
f.waiters = newWaiters
}
// HasWaiters returns true if After has been called on f but not yet satisfied (so you can
// HasWaiters returns true if After or AfterFunc has been called on f but not yet satisfied (so you can
// write race-free tests).
func (f *FakeClock) HasWaiters() bool {
f.lock.RLock()
@@ -245,6 +268,12 @@ func (*IntervalClock) NewTimer(d time.Duration) clock.Timer {
panic("IntervalClock doesn't implement NewTimer")
}
// AfterFunc is unimplemented, will panic.
// TODO: make interval clock use FakeClock so this can be implemented.
func (*IntervalClock) AfterFunc(d time.Duration, f func()) clock.Timer {
panic("IntervalClock doesn't implement AfterFunc")
}
// Tick is unimplemented, will panic.
// TODO: make interval clock use FakeClock so this can be implemented.
func (*IntervalClock) Tick(d time.Duration) <-chan time.Time {

4
vendor/modules.txt vendored
View File

@@ -2287,7 +2287,7 @@ k8s.io/sample-apiserver/pkg/registry/wardle/flunder
# k8s.io/system-validators v1.5.0 => k8s.io/system-validators v1.5.0
## explicit
k8s.io/system-validators/validators
# k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a => k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a
# k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b => k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
## explicit
k8s.io/utils/buffer
k8s.io/utils/clock
@@ -2772,7 +2772,7 @@ sigs.k8s.io/yaml
# k8s.io/sample-cli-plugin => ./staging/src/k8s.io/sample-cli-plugin
# k8s.io/sample-controller => ./staging/src/k8s.io/sample-controller
# k8s.io/system-validators => k8s.io/system-validators v1.5.0
# k8s.io/utils => k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a
# k8s.io/utils => k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
# modernc.org/cc => modernc.org/cc v1.0.0
# modernc.org/golex => modernc.org/golex v1.0.0
# modernc.org/mathutil => modernc.org/mathutil v1.0.0