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

Binner

Bins a stream of events to a new stream of events with a fixed frequency.

Constructor Summary

Public Constructor
public

constructor(size: *, processor: *, observer: *)

Method Summary

Public Methods
public

addEvent(event: *)

Add an event, which will be assigned to a bucket.

public

flush()

Forces the current buckets to emit

public

getEdgeValues(range: *, v1: *, v2: *, intersection: *): *

|-range -----------|

public

incrementActiveBucketList(timestamp: *): *

Gets the current bucket or returns a new one.

public

onEmit(cb: *)

Set the emit callback after the constructor

Public Constructors

public constructor(size: *, processor: *, observer: *) source

Params:

NameTypeAttributeDescription
size *
processor *
observer *

Public Methods

public addEvent(event: *) source

Add an event, which will be assigned to a bucket. TODO: If we make the cache more general we should pass in a callback here.

Params:

NameTypeAttributeDescription
event *

public flush() source

Forces the current buckets to emit

public getEdgeValues(range: *, v1: *, v2: *, intersection: *): * source

|-range -----------| |-bucket------------| | x | - v2 | | o | - va x | | - v1 |-intersect--| |

Params:

NameTypeAttributeDescription
range *
v1 *
v2 *
intersection *

Return:

*

public incrementActiveBucketList(timestamp: *): * source

Gets the current bucket or returns a new one.

If a new bucket is generated the result of the old bucket is emitted automatically.

Params:

NameTypeAttributeDescription
timestamp *

Return:

*

public onEmit(cb: *) source

Set the emit callback after the constructor

Params:

NameTypeAttributeDescription
cb *