Home Identifier Source
import Bucket from '@esnet/pond/src/bucket.js'
public class | source

Bucket

A bucket is a mutable collection of values that is used to accumulate aggregations over the index. The index may be an Index instance or a string.

The left side of the index is the range indicator, which is itself a combination of a letter and a number:

- the letter is the unit, either s (seconds), d (days),
  h (hours), or d (days).
- the size is the quantity of that unit.

So 6h is six hours, 7d is seven days.

The right side of the index is a number, which is n number of that range since Jan 1, 1970 UTC.

And example of an index might be 1d-1673. This uniquely refers to a block of time 1 day long, starting 1673 days after the beginning of 1970.

Constructor Summary

Public Constructor
public

constructor(index: *)

Method Summary

Public Methods
public

addEvent(event: *, cb: *)

public

aggregate(operator: *, cb: *)

Takes the values within the bucket and aggregates them together

public

begin(): *

public

collect(cb: *)

Takes the values within the bucket and collects them together

public

end(): *

public

index(): *

public

name(): *

public

range(): *

public

timerange(): *

public
public

Public Constructors

public constructor(index: *) source

Params:

NameTypeAttributeDescription
index *

Public Methods

public addEvent(event: *, cb: *) source

Params:

NameTypeAttributeDescription
event *
cb *

public aggregate(operator: *, cb: *) source

Takes the values within the bucket and aggregates them together into a new IndexedEvent using the operator supplied. Then result or error is passed to the callback.

Params:

NameTypeAttributeDescription
operator *
cb *

public begin(): * source

Return:

*

public collect(cb: *) source

Takes the values within the bucket and collects them together into a new IndexedSeries using the operator supplied. Then result or error is passed to the callback.

Params:

NameTypeAttributeDescription
cb *

public end(): * source

Return:

*

public index(): * source

Return:

*

public name(): * source

Return:

*

public range(): * source

Return:

*

public timerange(): * source

Return:

*

public toLocalString(): * source

Return:

*

public toUTCString(): * source

Return:

*