tenancy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tenancy provides bounded, process-local tenant concurrency accounting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidID

func ValidID(id string) bool

ValidID bounds hash input and rejects whitespace, control bytes and combined headers.

Types

type Config

type Config struct {
	Limit, MaxTracked             int
	IdleTTL                       time.Duration
	MissingShared, OverflowShared bool
	Limits                        map[string]int
}

type Lease

type Lease struct {
	// contains filtered or unexported fields
}

func (*Lease) Release

func (t *Lease) Release(now time.Time)

Release is idempotent. Active entries never expire or get evicted.

func (*Lease) Retain

func (t *Lease) Retain()

Retain records successful service admission. Unused reservations are discarded.

type Limiter

type Limiter struct {
	// contains filtered or unexported fields
}

func New

func New(c Config) *Limiter

func (*Limiter) Acquire

func (l *Limiter) Acquire(id string, now time.Time) (*Lease, admission.Decision)

func (*Limiter) Snapshot

func (l *Limiter) Snapshot(now time.Time) State

type State

type State struct {
	Limit, MaxTracked, Tracked, IdentifiedActive, MissingActive, OverflowActive int
	Expired                                                                     uint64
}

Jump to

Keyboard shortcuts

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