Interface TimeReservoir<V>
- All Known Implementing Classes:
AbstractSlidingWindowTimeReservoir
,UniformTimeReservoir
public interface TimeReservoir<V>
A statistically representative reservoir of a data stream in time.
Compared to Dropwizard Reservoir, this interface adds a possibility to work with data that is associated with a specific
time. It may not be possible; however, to obtain a snapshot or size at some moment in past due to performance optimizations.
- Author:
- Stepan Vavra
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetSnapshot
(long time, TimeUnit timeUnit) Returns a snapshot of the reservoir's values at given time or newer.long
The time interval this reservoir stores data of.int
Returns the number of values recorded at given time or newer.void
Adds a new recorded value to the reservoir bound to a given time.
-
Method Details
-
size
Returns the number of values recorded at given time or newer. It may not be supported to return a size in past due to performance optimizations.- Parameters:
time
- The time to get the size fortimeUnit
- Time unit of the provided time- Returns:
- the number of values recorded for given time or newer
-
update
Adds a new recorded value to the reservoir bound to a given time.- Parameters:
value
- a new recorded valuetime
- The time the recorded value occurred attimeUnit
- Time unit of the provided time
-
getSnapshot
Returns a snapshot of the reservoir's values at given time or newer. It may not be supported to return a snapshot in past due to performance optimizations.- Parameters:
time
- The time for which to get the snapshottimeUnit
- Time unit of the provided time- Returns:
- a snapshot of the reservoir's values for given time or newer
-
interval
The time interval this reservoir stores data of.- Parameters:
timeUnit
- The time unit in which to get the interval- Returns:
- The time interval of this time reservoir
-