Documentation
¶
Overview ¶
Package admission provides public access to admission control primitives.
This package re-exports types from the internal admission implementation, making them available for external consumers who need to customize admission behavior beyond the defaults provided by unary.New() or serverstream.New().
Most users will not need this package directly — the WithAdmissionLimit(n) option function on each RPC package is the preferred way to set capacity. This package is for advanced use cases that need direct limiter access.
Package admission provides public access to admission control primitives.
Admission control limits the number of concurrent requests a gRPC service processes. When capacity is reached, new requests are either rejected, queued, or admitted with a backpressure signal.
Most users do not need this package directly — use the WithAdmissionLimit(n) option on each RPC package instead. This package is for advanced use cases that need direct limiter access.
Example:
limiter := admission.NewLimiter(100) // max 100 concurrent u := unary.New(unary.WithAdmissionLimiter(limiter))
Index ¶
Constants ¶
const ( // DecisionAllow means execution is fully admitted. DecisionAllow = admission.DecisionAllow // DecisionReject means execution MUST NOT proceed. DecisionReject = admission.DecisionReject // DecisionAllowWithSignal means execution proceeds // but admission failure must be surfaced to the caller. DecisionAllowWithSignal = admission.DecisionAllowWithSignal )
Variables ¶
var ( // ErrAdmissionRejected indicates execution was not admitted. ErrAdmissionRejected = admission.ErrAdmissionRejected // ErrAdmissionSignaled indicates execution was admitted // but with an explicit failure signal. ErrAdmissionSignaled = admission.ErrAdmissionSignaled )
Error sentinels for admission outcomes.
var IsRejected = admission.IsRejected
IsRejected returns true if the error represents a hard admission rejection.
var IsSignaled = admission.IsSignaled
IsSignaled returns true if the error represents a soft admission signal.
var ResolveDecision = admission.ResolveDecision
ResolveDecision maps ExecutionGuarantees into an admission decision.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller = admission.Controller
Controller evaluates whether an execution may proceed based on the configured limiter and admission mode.
func NewController ¶
func NewController(limiter *Limiter) *Controller
NewController creates a new admission controller.
type Limiter ¶
Limiter enforces concurrent execution capacity.
Semantics:
capacity > 0 → bounded capacity capacity == 0 → no capacity (reject all) capacity < 0 → unlimited capacity
func NewLimiter ¶
NewLimiter creates a new admission limiter with the given capacity.
admission.NewLimiter(100) → max 100 concurrent admission.NewLimiter(-1) → unlimited admission.NewLimiter(0) → reject all