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:
    https://github.com/dropwizard/metrics
    • Method Detail

      • size

        int size​(long time,
                 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 for
        timeUnit - Time unit of the provided time
        Returns:
        the number of values recorded for given time or newer
      • update

        void update​(V value,
                    long time,
                    TimeUnit timeUnit)
        Adds a new recorded value to the reservoir bound to a given time.
        Parameters:
        value - a new recorded value
        time - The time the recorded value occurred at
        timeUnit - Time unit of the provided time
      • getSnapshot

        UniformTimeSnapshot getSnapshot​(long time,
                                        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 snapshot
        timeUnit - Time unit of the provided time
        Returns:
        a snapshot of the reservoir's values for given time or newer
      • interval

        long interval​(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