Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsolidationFunc ¶
ConsolidationFunc consolidates a bunch of datapoints into a single float value.
type SeriesLookbackConsolidator ¶
type SeriesLookbackConsolidator struct {
// contains filtered or unexported fields
}
SeriesLookbackConsolidator is a helper for consolidating a full single series. It has some differences with the step consolidator in that it collects points for a single series, and is reset when the next series needs to be consolidated.
func NewSeriesLookbackConsolidator ¶
func NewSeriesLookbackConsolidator( lookbackDuration, stepSize time.Duration, startTime time.Time, fn ConsolidationFunc, ) *SeriesLookbackConsolidator
NewSeriesLookbackConsolidator creates a single value consolidator used for series iteration with a given lookback.
func (*SeriesLookbackConsolidator) AddPoint ¶
func (c *SeriesLookbackConsolidator) AddPoint( dp ts.Datapoint, )
AddPoint adds a datapoint if it's within the valid time period; otherwise drops it silently, which is fine for consolidation.
func (*SeriesLookbackConsolidator) ConsolidateAndMoveToNext ¶
func (c *SeriesLookbackConsolidator) ConsolidateAndMoveToNext() float64
ConsolidateAndMoveToNext consolidates the current values and moves the consolidator to the next given value, purging stale values.
func (*SeriesLookbackConsolidator) Empty ¶
func (c *SeriesLookbackConsolidator) Empty() bool
Empty returns true if there are no datapoints in the consolidator. It is used to let consumers of the consolidators shortcircuit logic.
func (*SeriesLookbackConsolidator) Reset ¶
func (c *SeriesLookbackConsolidator) Reset( startTime time.Time, )
Reset purges all points from the consolidator. This should be called when moving to the next series to consolidate.
type StepCollector ¶ added in v0.6.0
StepCollector is implemented by any accumulators or consolidators working on stepwise iteration.
type StepLookbackAccumulator ¶ added in v0.6.0
type StepLookbackAccumulator struct {
// contains filtered or unexported fields
}
StepLookbackAccumulator is a helper for accumulating series in a step-wise fashion. It takes a 'step' of values, which represents a vertical slice of time across a list of series, and accumulates them when a valid step has been reached.
func NewStepLookbackAccumulator ¶ added in v0.6.0
func NewStepLookbackAccumulator( lookbackDuration, stepSize time.Duration, startTime time.Time, resultSize int, ) *StepLookbackAccumulator
NewStepLookbackAccumulator creates an accumulator used for step iteration across a series list with a given lookback.
func (*StepLookbackAccumulator) AccumulateAndMoveToNext ¶ added in v0.6.0
func (c *StepLookbackAccumulator) AccumulateAndMoveToNext() []xts.Datapoints
AccumulateAndMoveToNext consolidates the current values and moves the consolidator to the next given value, purging stale values.
func (*StepLookbackAccumulator) AddPointForIterator ¶ added in v0.6.0
func (c *StepLookbackAccumulator) AddPointForIterator( dp ts.Datapoint, i int, )
AddPointForIterator adds a datapoint to a given step if it's within the valid time period; otherwise drops it silently, which is fine for accumulation.
type StepLookbackConsolidator ¶
type StepLookbackConsolidator struct {
// contains filtered or unexported fields
}
StepLookbackConsolidator is a helper for consolidating series in a step-wise fashion. It takes a 'step' of values, which represents a vertical slice of time across a list of series, and consolidates when a valid step has been reached.
func NewStepLookbackConsolidator ¶
func NewStepLookbackConsolidator( lookbackDuration, stepSize time.Duration, startTime time.Time, resultSize int, fn ConsolidationFunc, ) *StepLookbackConsolidator
NewStepLookbackConsolidator creates a multivalue consolidator used for step iteration across a series list with a given lookback.
func (*StepLookbackConsolidator) AddPointForIterator ¶
func (c *StepLookbackConsolidator) AddPointForIterator( dp ts.Datapoint, i int, )
AddPointForIterator adds a datapoint to a given step if it's within the valid time period; otherwise drops it silently, which is fine for consolidation.
func (*StepLookbackConsolidator) ConsolidateAndMoveToNext ¶
func (c *StepLookbackConsolidator) ConsolidateAndMoveToNext() []float64
ConsolidateAndMoveToNext consolidates the current values and moves the consolidator to the next given value, purging stale values.