Scheduler uses TTLStore for assumed pods
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
// needs to do arbitrary things based on time.
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
Since(time.Time) time.Duration
|
||||
}
|
||||
|
||||
// RealClock really calls time.Now()
|
||||
@@ -34,6 +35,11 @@ func (r RealClock) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
// Since returns time since the specified timestamp.
|
||||
func (r RealClock) Since(ts time.Time) time.Duration {
|
||||
return time.Since(ts)
|
||||
}
|
||||
|
||||
// FakeClock implements Clock, but returns an arbitary time.
|
||||
type FakeClock struct {
|
||||
Time time.Time
|
||||
@@ -43,3 +49,8 @@ type FakeClock struct {
|
||||
func (f *FakeClock) Now() time.Time {
|
||||
return f.Time
|
||||
}
|
||||
|
||||
// Since returns time since the time in f.
|
||||
func (f *FakeClock) Since(ts time.Time) time.Duration {
|
||||
return f.Time.Sub(ts)
|
||||
}
|
||||
|
Reference in New Issue
Block a user