v1

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Sum   float64
	Count int64
	// contains filtered or unexported fields
}

type ReduceFn

type ReduceFn func(*Bucket)

type RollingWindow

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

func New

func New(size int, eachBucketTime time.Duration) *RollingWindow

New 计算当前时间所属window的开始时间, 以此时间为截止时间(采用时间bucket.startTime当标准), 返回之前一个窗口周期内的bucket

func (*RollingWindow) Add

func (r *RollingWindow) Add(v float64)

func (*RollingWindow) Reduce

func (r *RollingWindow) Reduce(fn ReduceFn)

Jump to

Keyboard shortcuts

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