series

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

* This file is part of Go Responsiveness. * * Go Responsiveness is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software Foundation, * either version 2 of the License, or (at your option) any later version. * Go Responsiveness is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSequentialIncreasesLessThan

func AllSequentialIncreasesLessThan[Data utilities.Number, Bucket utilities.Number](s WindowSeries[Data, Bucket], limit float64,
) (bool, bool, float64)

func CalculateAverage

func CalculateAverage[Data utilities.Number, Bucket utilities.Number](s WindowSeries[Data, Bucket]) (bool, float64)

func Percentile

func Percentile[Data utilities.Number, Bucket utilities.Number](s WindowSeries[Data, Bucket], p uint) (bool, Data)

func SeriesStandardDeviation

func SeriesStandardDeviation[Data utilities.Number, Bucket utilities.Number](s WindowSeries[Data, Bucket]) (bool, float64)

func TrimmedMean

func TrimmedMean[Data utilities.Number, Bucket utilities.Number](s WindowSeries[Data, Bucket], trim int) (bool, float64, []Data)

Types

type NumericBucketGenerator

type NumericBucketGenerator[T utilities.Number] struct {
	// contains filtered or unexported fields
}

func NewNumericBucketGenerator

func NewNumericBucketGenerator[T utilities.Number](initialValue T) NumericBucketGenerator[T]

func (*NumericBucketGenerator[T]) Generate

func (bg *NumericBucketGenerator[T]) Generate() T

type SeriesMessage

type SeriesMessage[Data any, BucketType constraints.Ordered] struct {
	Type    SeriesMessageType
	Bucket  BucketType
	Measure utilities.Optional[Data]
}

type SeriesMessageType

type SeriesMessageType int
const (
	SeriesMessageReserve SeriesMessageType = iota
	SeriesMessageMeasure SeriesMessageType = iota
)

type WindowSeries

type WindowSeries[Data any, Bucket utilities.Number] interface {
	fmt.Stringer

	Reserve(b Bucket) error
	Fill(b Bucket, d Data) error

	Count() (some int, none int)

	ForEach(func(Bucket, *utilities.Optional[Data]))

	GetValues() []utilities.Optional[Data]
	Complete() bool
	GetType() WindowSeriesDuration

	ExtractBoundedSeries() WindowSeries[Data, Bucket]

	Append(appended *WindowSeries[Data, Bucket])
	BoundedAppend(appended *WindowSeries[Data, Bucket])

	GetBucketBounds() (Bucket, Bucket)

	SetTrimmingBucketBounds(Bucket, Bucket)
	ResetTrimmingBucketBounds()
}

func NewWindowSeries

func NewWindowSeries[Data any, Bucket utilities.Number](tipe WindowSeriesDuration, windowSize int) WindowSeries[Data, Bucket]

type WindowSeriesDuration

type WindowSeriesDuration int
const (
	Forever    WindowSeriesDuration = iota
	WindowOnly WindowSeriesDuration = iota
)

Jump to

Keyboard shortcuts

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