Class AbstractRRD

  • Direct Known Subclasses:
    RRDv1, RRDv3

    public abstract class AbstractRRD
    extends java.lang.Object
    The Abstract RRD (Round Robin Database).
    Author:
    Alejandro Galue
    • Constructor Detail

      • AbstractRRD

        public AbstractRRD()
    • Method Detail

      • createRRD

        protected abstract AbstractRRD createRRD()
        Creates the RRD.
        Returns:
        the abstract RRD
      • getDataSources

        public abstract java.util.List<? extends AbstractDS> getDataSources()
        Gets the data sources.
        Returns:
        the data sources
      • getRras

        public abstract java.util.List<? extends AbstractRRA> getRras()
        Gets the RRAs.
        Returns:
        the RRAs
      • addRRA

        public abstract void addRRA​(AbstractRRA rra)
        Adds the RRA.
        Parameters:
        rra - the RRA
      • addDataSource

        public abstract void addDataSource​(AbstractDS ds)
        Adds the data source.
        Parameters:
        ds - the DS
      • getDataSource

        public abstract AbstractDS getDataSource​(int index)
        Gets the data source.
        Parameters:
        index - the index
        Returns:
        the data source
      • getVersion

        public java.lang.String getVersion()
        Gets the version of the RRD Dump.
        Returns:
        the version
      • setVersion

        public void setVersion​(java.lang.String version)
        Sets the version.
        Parameters:
        version - the new version
      • getStep

        public java.lang.Long getStep()
        Gets the step (interval) expressed in seconds.
        Returns:
        the step
      • setStep

        public void setStep​(java.lang.Long step)
        Sets the step.
        Parameters:
        step - the new step
      • getLastUpdate

        public java.lang.Long getLastUpdate()
        Gets the last update.
        Returns:
        the last update
      • setLastUpdate

        public void setLastUpdate​(java.lang.Long lastUpdate)
        Sets the last update.
        Parameters:
        lastUpdate - the new last update
      • getStartTimestamp

        public java.lang.Long getStartTimestamp​(AbstractRRA rra)
        Gets the start time stamp, expressed in seconds since 1970-01-01 UTC.
        Parameters:
        rra - the RRA
        Returns:
        the start time stamp (in seconds)
      • getEndTimestamp

        public java.lang.Long getEndTimestamp​(AbstractRRA rra)
        Gets the end time stamp, expressed in seconds since 1970-01-01 UTC.
        Parameters:
        rra - the RRA
        Returns:
        the end time stamp (in seconds)
      • findTimestampByRow

        public java.lang.Long findTimestampByRow​(AbstractRRA rra,
                                                 Row row)
        Finds the row time stamp, expressed in seconds since 1970-01-01 UTC.
        Parameters:
        rra - the RRA object
        row - the Row object
        Returns:
        the long
      • findRowByTimestamp

        public Row findRowByTimestamp​(AbstractRRA rra,
                                      java.lang.Long timestamp)
        Gets the row that corresponds to a specific time stamp (expressed in seconds since 1970-01-01 UTC).
        Parameters:
        rra - the RRA
        timestamp - the row time stamp
        Returns:
        the row object
      • merge

        public void merge​(AbstractRRD rrdSrc)
                   throws java.lang.IllegalArgumentException
        Merge.

        Merge the content of rrdSrc into this RRD.

        The format must be equal in order to perform the merge operation.

        Parameters:
        rrdSrc - the RRD source
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception
      • hasMergeableRRAs

        public boolean hasMergeableRRAs​(AbstractRRD rrdSrc)
        Checks for mergeable RRAs.
        Parameters:
        rrdSrc - the RRD source
        Returns:
        true, if there are mergeable RRAs
      • getMergeableRRA

        public AbstractRRA getMergeableRRA​(AbstractRRA rraSrc)
        Gets the mergeable RRA.
        Parameters:
        rraSrc - the source RRA
        Returns:
        the local RRA mergeable with rraSrc
      • merge

        public void merge​(java.util.List<? extends AbstractRRD> rrdList)
                   throws java.lang.IllegalArgumentException
        Merge.
        Parameters:
        rrdList - the RRD list
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception
      • split

        public java.util.List<AbstractRRD> split()
                                          throws java.lang.IllegalArgumentException
        Split.

        If the RRD contain several data sources, it will return one RRD per DS. Otherwise, it will throw an exception.

        Returns:
        the RRD list
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception
      • formatEquals

        public boolean formatEquals​(AbstractRRD rrd)
        Format equals.
        Parameters:
        rrd - the RRD object
        Returns:
        true, if successful
      • hasEqualsRras

        public boolean hasEqualsRras​(AbstractRRD rrd)
        Checks for equals RRAs.
        Parameters:
        rrd - the RRD object
        Returns:
        true, if successful
      • reset

        public void reset()
        Resets the row values for all the RRAs.

        Double.NaN will be stored on each slot

      • getIndex

        protected int getIndex​(java.lang.String dsName)
        Gets the index.
        Parameters:
        dsName - the DS name
        Returns:
        the index