Documentation
¶
Overview ¶
Package generationfence checks execution authority at the output consumer.
Index ¶
Constants ¶
const MaxStaleness = time.Second
Variables ¶
var ErrStale = errors.New("execution generation is no longer authoritative")
Functions ¶
This section is empty.
Types ¶
type Writer ¶
type Writer struct {
http.ResponseWriter
Check func() error
LocalCheck func() error
Watch func(invalidate func()) (unsubscribe func())
Interval time.Duration // zero defaults to MaxStaleness; larger values are capped
// contains filtered or unexported fields
}
Writer admits headers with a durable Check. Streaming authority is rechecked at most MaxStaleness after the last check started, independently of byte count. LocalCheck runs on every operation and must only inspect local cancellation, sealing and monotonic lease deadlines. Watch may invalidate cached authority from notification callbacks; it must not do database work. Call Close on exit. ResponseWriter operations, Validate and Close belong to the handler goroutine; only the Watch callback may run concurrently. No ReaderFrom/Unwrap bypass exists. An already admitted socket write cannot be recalled.
func (*Writer) Validate ¶
Validate shares the same budget with readers that check around a blocked read.