ring

package
v1.4.71 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

Number is an interface representing all numerical types in Go.

type Ring

type Ring[N Number] interface {
	Put(N)                        // Put adds a sample to the Ring.
	Average() float64             // Average computes the average value of all values in the Ring.
	Percentile(p float32) float64 // Percentile computes a given percentile value of all values in the Ring.
}

Ring is an entity capable of keeping only the a number of most recent values.

func New

func New[N Number](window int) Ring[N]

New returns a new default implementation of the Ring interface.

Jump to

Keyboard shortcuts

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