Object - streams : DistinctCount

Aggregator to get the distinct counts of values in streams.

Methods

Fields

  • distinctValues map (default {})
  • description

process

(anydata value, EventType eventType)

returns anydata

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 eventTypeis 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 or streams:RESET.

  • Return Type

    (anydata)
  • Updated distinct count.

copy

()

returns Aggregator

Returns a copy of the DistinctCount aggregator without its current state.

  • Return Type

    (Aggregator)
  • Returns DistinctCount aggregator.

saveState

()

returns map

Return current state to be saved as a map of any typed values.

  • Return Type

    (map)
  • A map of any typed values.

restoreState

Restores the saved state which is passed as a map of any typed values.

Parameters

  • state map
  • A map of typed any values. This map contains the values to be restored from the persisted data.