limiter

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package limiter provides configurations for controlling concurrency limit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScopeFrom

func ScopeFrom(ctx context.Context) (string, bool)

ScopeFrom retrieves scope from context.

func WithScope

func WithScope(ctx context.Context, scope string) context.Context

WithScope attaches the provided scope to context. It will later be used by components responsible for resource management for tracking and enforcing configured quotas.

Types

type ConcurrencyConfig

type ConcurrencyConfig struct {
	// MaxExecutions sets a limit on the number of active executions. A number of goroutines started by execution might be greater than 1.
	// A limit is enforced only when it is greater than zero.
	MaxExecutions int
	// GetMaxExecutions sets a limit on the number of active executions for a scope. A scope can be attached to context
	// using [WithScope] function. A number of goroutines started by execution might be greater than 1.
	// A limit is enforced only when it is greater than zero.
	GetMaxExecutions func(scope string) int
}

ConcurrencyConfig defines how many concurrent executions are allowed globally or per-scope.

Jump to

Keyboard shortcuts

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