class Defextends Source
RRD DEF (Data Source Definition) implementation.
Represents a data source defined in an RRD file with specific name, consolidation function, and backend configuration.
  • Field Details

    • rrdUri

      private final URI rrdUri
      The RRD file to read.
    • dsName

      private final String dsName
      The data source to read.
    • backend

      private final RrdBackendFactory backend
      Backend used to open the file.
    • consolFun

      private final ConsolFun consolFun
      Consolidation function to read with.
    • fetchData

      private FetchData fetchData
      The values fetched from the file.
  • Constructor Details

    • Def

      Def(String name, FetchData fetchData)
      Creates a DEF that reads the datasource of the same name, since the single name argument is used for both the DEF name and the datasource name within the RRD.
      Parameters:
      name - DEF name, also used as the name of the datasource to read
      fetchData - the fetched values backing this DEF, consulted by the accessors below
    • Def

      Def(String name, String dsName, FetchData fetchData)
      Creates a DEF for a named datasource of the RRD the fetch was run against, taking the file URI, the consolidation function and the backend from that fetch's request rather than from the caller.
      Parameters:
      name - DEF name, identifying this source within the graph's data set
      dsName - name of the datasource to read within the RRD, which need not match name
      fetchData - the fetched values backing this DEF, consulted by the accessors below
    • Def

      Def(String name, URI rrdUri, String dsName, ConsolFun consolFunc, RrdBackendFactory backend)
      Creates a DEF naming its RRD, datasource, consolidation function and backend explicitly, for callers that are not deriving them from a fetch. The URI is resolved to the backend's canonical form so two DEFs addressing the same store compare equal.
      Parameters:
      name - DEF name, identifying this source within the graph's data set
      rrdUri - location of the RRD holding the datasource, in any form the backend accepts
      dsName - name of the datasource to read within that RRD
      consolFunc - consolidation function (CF) the archive values were produced with
      backend - factory that opens the RRD and canonicalises rrdUri
  • Method Details

    • getCanonicalUri

      URI getCanonicalUri()
      Canonical uri.
      Returns:
      the RRD location in the backend's canonical form
    • getDsName

      String getDsName()
      Ds name.
      Returns:
      the name of the datasource read within the RRD
    • getConsolFun

      ConsolFun getConsolFun()
      Consol fun.
      Returns:
      the consolidation function the archive values were produced with
    • getBackend

      RrdBackendFactory getBackend()
      Data backend.
      Returns:
      the factory that opens the RRD for this DEF
    • isCompatibleWith

      boolean isCompatibleWith(Def def)
      Is compatible with
      Parameters:
      def - the other DEF to compare against
      Returns:
      true if both name the same RRD, CF and backend, so their values can be joined
    • getRrdDb

      RrdDb getRrdDb()
      Rrd db.
      Returns:
      the RRD database the enclosing fetch ran against
    • setFetchData

      void setFetchData(FetchData fetchData)
      Fetch data.
      Parameters:
      fetchData - the fetched values backing this DEF, consulted by the accessors below
    • getRrdTimestamps

      long[] getRrdTimestamps()
      Rrd timestamps.
      Returns:
      the equidistant timestamps of the fetched rows, in seconds
    • getRrdValues

      double[] getRrdValues()
      Rrd values.
      Returns:
      the archived values for this DEF's datasource, aligned with getRrdTimestamps()
    • getArchiveEndTime

      long getArchiveEndTime()
      Archive end time.
      Returns:
      the timestamp in seconds of the last populated slot in the archive
    • getFetchStep

      long getFetchStep()
      Fetch step.
      Returns:
      the seconds between consecutive timestamps in the fetched rows
    • isLoaded

      boolean isLoaded()
      Is loaded
      Returns:
      true if fetch data has been attached, so the value accessors will not fail