Documentation ¶
Overview ¶
Package timers provides a Clock abstraction useful for simulating timeouts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface { // Zero returns a reset Clock. TimeoutAt channels will use the point // at which Zero was called as their reference point. Zero() Clock // TimeoutAt returns a channel that fires delta time after Zero was called. // If delta has already passed, it returns a closed channel. // // TimeoutAt must be called after Zero; otherwise, the channel's behavior is undefined. TimeoutAt(delta time.Duration) <-chan time.Time // Encode serializes the Clock into a byte slice. Encode() []byte // Decode deserializes the Clock from a byte slice. // A Clock which has been Decoded from an Encoded Clock should produce // the same timeouts as the original Clock. Decode([]byte) (Clock, error) }
Clock provides timeout events which fire at some point after a point in time.
func MakeMonotonicClock ¶
MakeMonotonicClock creates a new monotonic clock with a given zero point.
type Monotonic ¶
type Monotonic struct {
// contains filtered or unexported fields
}
Monotonic uses the system's monotonic clock to emit timeouts.
Click to show internal directories.
Click to hide internal directories.