window

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: BSD-3-Clause Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddSampleFunc

type AddSampleFunc func(current, new interface{}) interface{}

type AggregateBlocksFunc

type AggregateBlocksFunc func(block []interface{}, start int, size int) interface{}

type AggregateSingleFunc

type AggregateSingleFunc func(value interface{}, count int) interface{}

type Settings added in v0.5.7

type Settings struct {
	Size          int
	Resolution    int
	ExternalTimer bool

	TotalCountModifier int
}

func (*Settings) SetAdditionalSettings added in v0.5.7

func (s *Settings) SetAdditionalSettings(as map[string]string) error

type SlidingTimeWindow

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

SlidingTimeWindow - A sliding window based on time. Relies on external entity moving window along by calling NextBlock at the appropriate time. note: using interface{} 4x slower than using specific types, starting with interface{} for expediency

func (*SlidingTimeWindow) AddSample

func (w *SlidingTimeWindow) AddSample(sample interface{}) (bool, interface{})

AddSample implements window.Window.AddSample

func (*SlidingTimeWindow) NextBlock

func (w *SlidingTimeWindow) NextBlock() (bool, interface{})

type SlidingWindow

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

note: using interface{} 4x slower than using specific types, starting with interface{} for expediency todo split external vs on-add timer

func (*SlidingWindow) AddSample

func (w *SlidingWindow) AddSample(sample interface{}) (bool, interface{})

AddSample implements window.Window.AddSample

type TimeWindow

type TimeWindow interface {
	Window

	// NextBlock tells the time window to advance
	NextBlock() (bool, interface{})
}

TimeWindow a time based sample window

func NewSlidingTimeWindow

func NewSlidingTimeWindow(addFunc AddSampleFunc, aggFunc AggregateBlocksFunc, settings *Settings) TimeWindow

func NewTumblingTimeWindow

func NewTumblingTimeWindow(addFunc AddSampleFunc, aggFunc AggregateSingleFunc, settings *Settings) TimeWindow

type TumblingTimeWindow

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

TumblingTimeWindow - A tumbling window based on time. Relies on external entity moving window along by calling NextBlock at the appropriate time. note: using interface{} 4x slower than using specific types, starting with interface{} for expediency

func (*TumblingTimeWindow) AddSample

func (w *TumblingTimeWindow) AddSample(sample interface{}) (bool, interface{})

func (*TumblingTimeWindow) NextBlock

func (w *TumblingTimeWindow) NextBlock() (bool, interface{})

type TumblingWindow

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

note: using interface{} 4x slower than using specific types, starting with interface{} for expediency

func (*TumblingWindow) AddSample

func (w *TumblingWindow) AddSample(sample interface{}) (bool, interface{})

AddSample implements window.Window.AddSample

type Window

type Window interface {
	// AddSample adds a sample to the window
	AddSample(sample interface{}) (bool, interface{})
}

Window is a basic sample window

func NewSlidingWindow

func NewSlidingWindow(aggFunc AggregateBlocksFunc, settings *Settings) Window

func NewTumblingWindow

func NewTumblingWindow(addFunc AddSampleFunc, aggFunc AggregateSingleFunc, settings *Settings) Window

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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