generationfence

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package generationfence checks execution authority at the output consumer.

Index

Constants

View Source
const MaxStaleness = time.Second

Variables

View Source
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) Close

func (w *Writer) Close()

func (*Writer) Flush

func (w *Writer) Flush()

func (*Writer) Validate

func (w *Writer) Validate() error

Validate shares the same budget with readers that check around a blocked read.

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(status int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL