Documentation
¶
Overview ¶
Package compression coordinates content-coding selection for response compression plugins. Plugins register their route-owned offers before the downstream handler writes the final response; the shared state then makes a single, order-independent decision.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is the per-request offer set and frozen negotiation result. The mutex covers both registration and decision so a late registration cannot race with, or mutate, a result that has already been selected.
func Register ¶
Register adds offers to the request's shared negotiation state. The returned request carries the state in its context and must be passed to the downstream handler. Once Decide has frozen the state, later registrations are deliberately ignored so repeated middleware callbacks remain idempotent.
func (*State) Decide ¶
func (s *State) Decide(meta ResponseMeta) Decision
Decide freezes the complete offer set and returns the same result for every subsequent call. Eligibility is evaluated against the final response metadata supplied by the caller.