buffer

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvgCache

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

func NewAvgCache

func NewAvgCache(startTime time.Time, endTime time.Time) *AvgCache

func (*AvgCache) Add

func (ac *AvgCache) Add(o *outcome.Outcome)

func (*AvgCache) GetOutputs

func (ac *AvgCache) GetOutputs() []types.AverageOutput

func (*AvgCache) GetProtoOutputs

func (ac *AvgCache) GetProtoOutputs() []*pb.AverageOutput

func (*AvgCache) Reset

func (ac *AvgCache) Reset(nextStartTime time.Time, nextEndTime time.Time)

type Buffer

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

func New

func New(ctx context.Context, cfg *config.Buffer, flushFunc FlushFunc, log *slog.Logger) (*Buffer, error)

func (*Buffer) Add

func (b *Buffer) Add(ctx context.Context, data *outcome.Outcome)

func (*Buffer) Flush

func (b *Buffer) Flush(parentCtx context.Context) error

func (*Buffer) Start

func (b *Buffer) Start(ctx context.Context)

func (*Buffer) Stop

func (b *Buffer) Stop() error

type FlushFunc

type FlushFunc func(ctx context.Context, data *FlushOutcome) error

type FlushOutcome

type FlushOutcome struct {
	Outcomes   []outcome.Outcome     `json:"outcomes"`
	AvgOutputs []types.AverageOutput `json:"average_outputs"`
}

type RunningAvg

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

func NewRunningAvg

func NewRunningAvg(o *outcome.Outcome, startTime time.Time, endTime time.Time, baseline float64) *RunningAvg

func (*RunningAvg) Add

func (ra *RunningAvg) Add(v float64)

Jump to

Keyboard shortcuts

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