Interface TimeReservoir<V>
-
- All Known Implementing Classes:
AbstractSlidingWindowTimeReservoir
,AggregatedSlidingWindowTimeReservoir
,SlidingWindowTimeReservoir
,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.- See Also:
- https://github.com/dropwizard/metrics
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description UniformTimeSnapshot
getSnapshot(long time, java.util.concurrent.TimeUnit timeUnit)
Returns a snapshot of the reservoir's values at given time or newer.long
interval(java.util.concurrent.TimeUnit timeUnit)
The time interval this reservoir stores data of.int
size(long time, java.util.concurrent.TimeUnit timeUnit)
Returns the number of values recorded at given time or newer.void
update(V value, long time, java.util.concurrent.TimeUnit timeUnit)
Adds a new recorded value to the reservoir bound to a given time.
-
-
-
Method Detail
-
size
int size(long time, java.util.concurrent.TimeUnit timeUnit)
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
void update(V value, long time, java.util.concurrent.TimeUnit timeUnit)
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
UniformTimeSnapshot getSnapshot(long time, java.util.concurrent.TimeUnit timeUnit)
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
long interval(java.util.concurrent.TimeUnit timeUnit)
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
-
-