admission

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 1 Imported by: 0

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

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

View Source
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.

View Source
var IsRejected = admission.IsRejected

IsRejected returns true if the error represents a hard admission rejection.

View Source
var IsSignaled = admission.IsSignaled

IsSignaled returns true if the error represents a soft admission signal.

View Source
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 Decision

type Decision = admission.Decision

Decision represents the outcome of admission evaluation.

type Limiter

type Limiter = admission.Limiter

Limiter enforces concurrent execution capacity.

Semantics:

capacity > 0  → bounded capacity
capacity == 0 → no capacity (reject all)
capacity < 0  → unlimited capacity

func NewLimiter

func NewLimiter(capacity int) *Limiter

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

Jump to

Keyboard shortcuts

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