java.lang.Object
org.rrd4j.core.DataImporter
- All Implemented Interfaces:
Closeable, AutoCloseable
- Direct Known Subclasses:
RrdToolReader, XmlReader
Constructor Summary
ConstructorsConstructorDescriptionCreates an importer; every subclass reads its source in its own constructorMethod Summary
Modifier and TypeMethodDescriptionvoidclose()Releases the import source once the RRD has been written.abstract doublegetAccumValue(int dsIndex) Reads the partial total a data source is carrying into the current step.abstract intCounts the archives (RRAs) declared by the RRD.abstract ConsolFungetConsolFun(int arcIndex) Reads the consolidation function of an archive.abstract intCounts the data sources declared by the RRD.abstract StringgetDsName(int dsIndex) Reads the name of a data source.abstract DsTypegetDsType(int dsIndex) Reads the type of a data source.protected longEstimates the byte length needed to hold everything this importer exposes.abstract longgetHeartbeat(int dsIndex) Reads the heartbeat of a data source.abstract longReads the moment the RRD was last updated.abstract doublegetLastValue(int dsIndex) Reads the last value recorded for a data source.abstract doublegetMaxValue(int dsIndex) Reads the upper bound a data source accepts.abstract doublegetMinValue(int dsIndex) Reads the lower bound a data source accepts.abstract longgetNanSeconds(int dsIndex) Reads when a data source last saw a usable sample.abstract intgetRows(int arcIndex) Counts the rows an archive currently holds.abstract doublegetStateAccumValue(int arcIndex, int dsIndex) Reads the value an archive is accumulating for one data source.abstract intgetStateNanSteps(int arcIndex, int dsIndex) Counts the unknown primary data points an archive is holding.abstract longgetStep()Reads the base interval between two primary data points.abstract intgetSteps(int arcIndex) Reads how many primary data points one archive row covers.abstract double[]getValues(int arcIndex, int dsIndex) Reads one data source's series from an archive.abstract StringReads the RRD file format version the export was written with.abstract doublegetXff(int arcIndex) Reads the xfiles factor of an archive.(package private) voidrelease()Frees whatever the importer holds open; the default importer needs nothing.
Constructor Details
DataImporter
public DataImporter()Creates an importer; every subclass reads its source in its own constructor
Method Details
getVersion
Reads the RRD file format version the export was written with.- Returns:
- the version string, such as "008"
- Throws:
IOException- if the export cannot be read
getLastUpdateTime
Reads the moment the RRD was last updated.- Returns:
- a unix timestamp in seconds, aligned to the step boundary
- Throws:
IOException- if the export cannot be read
getStep
Reads the base interval between two primary data points.- Returns:
- the step size in seconds
- Throws:
IOException- if the export cannot be read
getDsCount
Counts the data sources declared by the RRD.- Returns:
- the number of data sources
- Throws:
IOException- if the export cannot be read
getArcCount
Counts the archives (RRAs) declared by the RRD.- Returns:
- the number of archives
- Throws:
IOException- if the export cannot be read
getDsName
Reads the name of a data source.- Parameters:
dsIndex- zero-based index of the data source- Returns:
- the data source name
- Throws:
IOException- if the export cannot be read
getDsType
Reads the type of a data source.- Parameters:
dsIndex- zero-based index of the data source- Returns:
- the type driving how consecutive samples are combined
- Throws:
IOException- if the export cannot be read
getHeartbeat
Reads the heartbeat of a data source.- Parameters:
dsIndex- zero-based index of the data source- Returns:
- the maximum gap in seconds between two updates before the data source is declared dead
- Throws:
IOException- if the export cannot be read
getMinValue
Reads the lower bound a data source accepts.- Parameters:
dsIndex- zero-based index of the data source- Returns:
- the minimum value, or NaN when unbounded
- Throws:
IOException- if the export cannot be read
getMaxValue
Reads the upper bound a data source accepts.- Parameters:
dsIndex- zero-based index of the data source- Returns:
- the maximum value, or NaN when unbounded
- Throws:
IOException- if the export cannot be read
getLastValue
Reads the last value recorded for a data source.- Parameters:
dsIndex- zero-based index of the data source- Returns:
- the most recent value, unknown until the next update lands
- Throws:
IOException- if the export cannot be read
getAccumValue
Reads the partial total a data source is carrying into the current step.- Parameters:
dsIndex- zero-based index of the data source- Returns:
- the value accumulated so far for the step being built
- Throws:
IOException- if the export cannot be read
getNanSeconds
Reads when a data source last saw a usable sample.- Parameters:
dsIndex- zero-based index of the data source- Returns:
- a unix timestamp in seconds of the last valid sample, or 0 if it never had one
- Throws:
IOException- if the export cannot be read
getConsolFun
Reads the consolidation function of an archive.- Parameters:
arcIndex- zero-based index of the archive- Returns:
- the function folding primary data points into one row
- Throws:
IOException- if the export cannot be read
getXff
Reads the xfiles factor of an archive.- Parameters:
arcIndex- zero-based index of the archive- Returns:
- the share of a step that an unknown value occupies, from 0 to 1
- Throws:
IOException- if the export cannot be read
getSteps
Reads how many primary data points one archive row covers.- Parameters:
arcIndex- zero-based index of the archive- Returns:
- the number of steps consolidated into a single row
- Throws:
IOException- if the export cannot be read
getRows
Counts the rows an archive currently holds.- Parameters:
arcIndex- zero-based index of the archive- Returns:
- the number of archive rows stored, which bounds
getValues(int, int)in length - Throws:
IOException- if the export cannot be read
getStateAccumValue
Reads the value an archive is accumulating for one data source.- Parameters:
arcIndex- zero-based index of the archivedsIndex- zero-based index of the data source- Returns:
- the accumulated value held in the archive state, waiting for the next step
- Throws:
IOException- if the export cannot be read
getStateNanSteps
Counts the unknown primary data points an archive is holding.- Parameters:
arcIndex- zero-based index of the archivedsIndex- zero-based index of the data source- Returns:
- the number of unknown steps inside the archive state, waiting for the next step
- Throws:
IOException- if the export cannot be read
getValues
Reads one data source's series from an archive.- Parameters:
arcIndex- zero-based index of the archivedsIndex- zero-based index of the data source- Returns:
- the archive's stored values, oldest first, one per
getRows(int)row - Throws:
IOException- if the export cannot be read
getEstimatedSize
Estimates the byte length needed to hold everything this importer exposes.- Returns:
- the file size in bytes to reserve before writing the RRD
- Throws:
IOException- if the export cannot be read
release
Frees whatever the importer holds open; the default importer needs nothing.- Throws:
IOException- if the underlying source cannot be closed
close
Releases the import source once the RRD has been written.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if the underlying source cannot be closed