Workex.Aggregate protocol
Specifies the protocol used by Workex
behaviour to aggregate incoming messages.
Summary
add(aggregate, message) | Adds the new item to the aggregate |
remove_oldest(aggregate) | Removes the oldest item from the collection |
size(aggregate) | Returns the number of aggregated items |
value(aggregate) | Produces an aggregated value from all collected items |
Functions
Specs:
Removes the oldest item from the collection.
Sometimes it doesn't make sense to implement this function, for example when the aggregation doesn't guarantee or preserve ordering. In such cases, just raise from the implementation, and document that the implementation can't be used with the replace_oldest
option.