Object -
streams
:
DistinctCount
Aggregator to get the distinct counts of values in streams.
Methods
Updates the current distinct count when a new event arrives and return the updated count. If the eventType
is
streams:CURRENT
, count is increased by 1. If the eventType
is streams:EXPIRED
, count is descreased by 1.
If the eventType
is streams:RESET
, count is reset, regardless of the value
.
Returns a copy of the DistinctCount
aggregator without its current state.
Return current state to be saved as a map of any
typed values.
Restores the saved state which is passed as a map of any
typed values.
Fields
- distinctValues map (default {})
-
description
Updates the current distinct count when a new event arrives and return the updated count. If the eventType
is
streams:CURRENT
, count is increased by 1. If the eventType
is streams:EXPIRED
, count is descreased by 1.
If the eventType
is streams:RESET
, count is reset, regardless of the value
.
Parameters
- value anydata
-
Value being counted uniquely.
- eventType EventType
-
Type of the incoming event
streams:CURRENT
,streams:EXPIRED
orstreams:RESET
.
-
Return Type
(anydata) Updated distinct count.
Returns a copy of the DistinctCount
aggregator without its current state.
-
Return Type
(Aggregator) Returns
DistinctCount
aggregator.
Return current state to be saved as a map of any
typed values.
-
Return Type
(map) A map of
any
typed values.