Documentation
¶
Overview ¶
Package clock provides the time source core depends on.
The reconciler's backoff (R-149) and the give-up window (R-150) are both time dependent, and a test that proves a ten-failure threshold inside a thirty-minute window must not take thirty minutes. Every core component takes a Clock rather than calling time.Now.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface {
// Now returns the current time, always UTC (design 00 §3.5).
Now() time.Time
// Since is shorthand for Now().Sub(t).
Since(t time.Time) time.Duration
// After behaves like time.After.
After(d time.Duration) <-chan time.Time
// Sleep blocks for d.
Sleep(d time.Duration)
}
Clock is a time source.
type Fake ¶
type Fake struct {
// contains filtered or unexported fields
}
Fake is a manually advanced clock for tests.
After returns a channel that fires when the fake clock is advanced past the deadline, so a test drives elapsed time explicitly instead of sleeping.
Click to show internal directories.
Click to hide internal directories.