Scheduler uses TTLStore for assumed pods

This commit is contained in:
Prashanth Balasubramanian
2015-03-30 11:17:16 -07:00
parent 43949b41d4
commit a7864aa230
10 changed files with 772 additions and 145 deletions

View File

@@ -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)
}