All Superinterfaces:
RrdUpdater<Robin>
All Known Implementing Classes:
RobinArray, RobinMatrix

public interface Robin extends RrdUpdater<Robin>
Class to represent archive values for a single datasource. Robin class is the heart of the so-called "round robin database" concept. Basically, each Robin object is a fixed length array of double values. Each double value represents consolidated, archived value for the specific timestamp. When the underlying array of double values gets completely filled, new values will replace the oldest ones.

Robin object does not hold values in memory - such object could be quite large. Instead of it, Robin reads them from the backend I/O only when necessary.

  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    void
    bulkStore(double newValue, int bulkCount)
    Appends one value repeatedly, for bulk updates.
    void
    Copies object's internal state to another Robin object.
    Renders the current contents as text.
    void
    filterValues(double minValue, double maxValue)
    Filters values stored in this archive based on the given boundary.
    Returns the Archive object to which this Robin object belongs.
    Required to implement RrdUpdater interface.
    Returns the underlying storage (backend) object which actually performs all I/O operations.
    int
    Returns the size of the underlying array of archived values.
    double
    getValue(int index)
    Returns the i-th value from the Robin archive.
    double[]
    Fetches all archived values.
    double[]
    getValues(int index, int count)
    Reads a run of values starting at a row index.
    void
    setValue(int index, double value)
    Sets the i-th value in the Robin archive.
    void
    setValues(double newValue)
    (Re)sets all values in this archive to the same value.
    void
    setValues(double... newValues)
    Updates archived values in bulk.
    void
    store(double newValue)
    Appends a single value at the current row pointer.
    void
    update(double[] newValues)
    Writes a full row of values into storage.
  • Method Details

    • getValues

      double[] getValues() throws IOException
      Fetches all archived values.
      Returns:
      Array of double archive values, starting from the oldest one.
      Throws:
      IOException - Thrown in case of I/O specific error.
    • setValues

      void setValues(double... newValues) throws IOException
      Updates archived values in bulk.
      Parameters:
      newValues - Array of double values to be stored in the archive
      Throws:
      IOException - Thrown in case of I/O error
      IllegalArgumentException - Thrown if the length of the input array is different from the length of this archive
    • setValues

      void setValues(double newValue) throws IOException
      (Re)sets all values in this archive to the same value.
      Parameters:
      newValue - New value
      Throws:
      IOException - Thrown in case of I/O error
    • getValue

      double getValue(int index) throws IOException
      Returns the i-th value from the Robin archive.
      Parameters:
      index - Value index
      Returns:
      Value stored in the i-th position (the oldest value has zero index)
      Throws:
      IOException - Thrown in case of I/O specific error.
    • setValue

      void setValue(int index, double value) throws IOException
      Sets the i-th value in the Robin archive.
      Parameters:
      index - index in the archive (the oldest value has zero index)
      value - value to be stored
      Throws:
      IOException - Thrown in case of I/O specific error.
    • getParent

      Archive getParent()
      Returns the Archive object to which this Robin object belongs.
      Returns:
      Parent Archive object
    • getSize

      int getSize()
      Returns the size of the underlying array of archived values.
      Returns:
      Number of stored values
    • copyStateTo

      void copyStateTo(Robin other) throws IOException

      Copies object's internal state to another Robin object.

      Specified by:
      copyStateTo in interface RrdUpdater<Robin>
      Parameters:
      other - a RrdUpdater object.
      Throws:
      IOException - if the state cannot be read from the backend
    • filterValues

      void filterValues(double minValue, double maxValue) throws IOException
      Filters values stored in this archive based on the given boundary. Archived values found to be outside of [minValue, maxValue] interval (inclusive) will be silently replaced with NaN.
      Parameters:
      minValue - inclusive lower bound; values below it become NaN
      maxValue - inclusive upper bound; values above it become NaN
      Throws:
      IOException - Thrown in case of I/O error
    • getRrdBackend

      RrdBackend getRrdBackend()
      Returns the underlying storage (backend) object which actually performs all I/O operations.
      Specified by:
      getRrdBackend in interface RrdUpdater<Robin>
      Returns:
      I/O backend object
    • getRrdAllocator

      RrdAllocator getRrdAllocator()
      Required to implement RrdUpdater interface. You should never call this method directly.
      Specified by:
      getRrdAllocator in interface RrdUpdater<Robin>
      Returns:
      Allocator object
    • update

      void update(double[] newValues) throws IOException
      Writes a full row of values into storage.
      Parameters:
      newValues - an array of double.
      Throws:
      IOException - Thrown in case of I/O error
    • dump

      String dump() throws IOException
      Renders the current contents as text.
      Returns:
      a String object.
      Throws:
      IOException - Thrown in case of I/O error
    • store

      void store(double newValue) throws IOException
      Appends a single value at the current row pointer.
      Parameters:
      newValue - a double.
      Throws:
      IOException - Thrown in case of I/O error
    • bulkStore

      void bulkStore(double newValue, int bulkCount) throws IOException
      Appends one value repeatedly, for bulk updates.
      Parameters:
      newValue - a double.
      bulkCount - a int.
      Throws:
      IOException - Thrown in case of I/O error
    • getValues

      double[] getValues(int index, int count) throws IOException
      Reads a run of values starting at a row index.
      Parameters:
      index - a int.
      count - a int.
      Returns:
      an array of double.
      Throws:
      IOException - Thrown in case of I/O error