Documentation
¶
Overview ¶
Package clock provides the Emulator clock (NFR-REL-002): real by default, or under --deterministic a fake clock that moves once per API request. Both can be advanced with `gcpemu time advance`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestStep ¶ added in v0.10.0
func RequestStep(c Clock)
RequestStep moves c one request step if it is a Stepper; the real clock is not, so the call is a no-op there.
Types ¶
type Fake ¶
Fake is a deterministic clock that starts at a fixed instant and moves forward by Step on each RequestStep; Now never moves it, so every read within one request returns the same instant (ADR 0020).
func (*Fake) RequestStep ¶ added in v0.10.0
func (f *Fake) RequestStep()
RequestStep moves the clock forward by Step, as an API request arriving at a Deterministic Instance does.
type Offset ¶
type Offset struct {
// contains filtered or unexported fields
}
Offset is a real clock that can be advanced for lifecycle/TTL tests.
func (*Offset) RequestStep ¶ added in v0.10.0
func (o *Offset) RequestStep()
RequestStep moves a fake base clock one request step.
type Stepper ¶ added in v0.10.0
type Stepper interface {
RequestStep()
}
Stepper is a clock that moves once per API request (ADR 0020).
type Stopwatch ¶ added in v0.6.0
type Stopwatch struct {
// contains filtered or unexported fields
}
Stopwatch times short intervals such as a loopback round trip. Go's monotonic clock on Windows advances only every ~0.5ms, so a fast hop timed with time.Since reads as zero there; Stopwatch reads a high-resolution counter instead.
func StartStopwatch ¶ added in v0.6.0
func StartStopwatch() Stopwatch
StartStopwatch starts a Stopwatch now.