Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultSleeper = sleeper{}
DefaultSleeper exports a sleeper so that the retrier can backoff at the right times. The reason for it's inclusion as a dependency is to allow mocking to work in the correct way, without any delays.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface { // Now returns the current local time. Now() time.Time // UTC returns the time now as UTC UTC() time.Time // After waits for the duration to elapse and then sends the current time // on the returned channel. // It is equivalent to NewTimer(d).C. // The underlying Timer is not recovered by the garbage collector // until the timer fires. If efficiency is a concern, use NewTimer // instead and call Timer.Stop if the timer is no longer needed. After(d time.Duration) <-chan time.Time }
Clock defines an interface for Clocks
type Sleeper ¶
type Sleeper interface { // Sleep pauses the current goroutine for at least the duration d. // A negative or zero duration causes Sleep to return immediately. Sleep(time.Duration) }
Sleeper defines a interface that handles sleeping at the right times
type WallClock ¶
type WallClock struct{}
WallClock represents an implementation of Clock, that uses the wall time.
func (WallClock) After ¶
After waits for the duration to elapse and then sends the current time on the returned channel. It is equivalent to NewTimer(d).C. The underlying Timer is not recovered by the garbage collector until the timer fires. If efficiency is a concern, use NewTimer instead and call Timer.Stop if the timer is no longer needed.