retention

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 2 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 retention implements process-wide packet retention accounting.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidLimits indicates non-positive packet or byte limits.
	ErrInvalidLimits = errors.New("invalid retention limits")
)

Functions

This section is empty.

Types

type Budget

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

Budget accounts retained packet capacity shared by independent queues.

func NewBudget

func NewBudget(limits Limits) (*Budget, error)

NewBudget returns an empty aggregate retention budget.

func (*Budget) Release

func (b *Budget) Release(packets, bytes int)

Release returns previously reserved capacity to the budget.

func (*Budget) Reserve

func (b *Budget) Reserve(packets, bytes int) bool

Reserve retains capacity only when both aggregate limits permit it.

func (*Budget) ResizeBytes

func (b *Budget) ResizeBytes(previous, next int) bool

ResizeBytes changes the byte charge of retained capacity without changing its packet charge.

func (*Budget) Usage

func (b *Budget) Usage() Usage

Usage returns the current packet and byte counts, sampled independently.

type Limits

type Limits struct {
	Packets int
	Bytes   int
}

Limits bound aggregate retained work by packet count and accounted bytes.

type Usage

type Usage struct {
	Packets int
	Bytes   int
}

Usage is one point-in-time aggregate retention measurement.

Jump to

Keyboard shortcuts

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