Documentation
¶
Overview ¶
Package inflight tracks a service's background work across Instance Resets. Work started before a Reset must not write into the store the instance resets afterwards. Tracker counts deferred work (#301): Reset starts a new generation, so work that noted the old one knows to drop itself, and waits for work already running. Loops runs background loops that Reset halts, waits for and later resumes (#307).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrReset = errors.New("inflight: background work halted by an Instance Reset")
ErrReset is the cancel cause of a Loops generation that Reset ended.
Functions ¶
Types ¶
type Loops ¶ added in v0.9.0
type Loops struct {
// contains filtered or unexported fields
}
Loops runs a service's background loops in generations (#307): Reset cancels the current generation and waits for its loops, so no iteration from before an Instance Reset outlives it, and Resume starts them again once the Store is reset too (emu.ResetFinisher). The zero value is ready to use.
func (*Loops) Reset ¶ added in v0.9.0
Reset cancels the current generation with ErrReset and waits for its loops, or for ctx to end, which it reports. The loops stay stopped until Resume.
func (*Loops) Resume ¶ added in v0.9.0
func (l *Loops) Resume()
Resume starts the loops again after Reset, unless Stop ran meanwhile. Loops of a Reset that ended before they returned may still be finishing.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker counts running work and the generations Reset starts. The zero value is ready to use.