java.lang.Object
org.rrd4j.data.Source
org.rrd4j.data.Def
RRD DEF (Data Source Definition) implementation.
Represents a data source defined in an RRD file with specific name, consolidation function, and backend configuration.
Represents a data source defined in an RRD file with specific name, consolidation function, and backend configuration.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RrdBackendFactoryBackend used to open the file.private final ConsolFunConsolidation function to read with.private final StringThe data source to read.private FetchDataThe values fetched from the file.private final URIThe RRD file to read.Fields inherited from class Source
timestamps, valuesModifier and TypeFieldDescriptionprotected long[]timestamps corresponding to data valuesprotected double[]data valuesConstructor Summary
ConstructorsConstructorDescriptionCreates 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.Creates a DEF naming its RRD, datasource, consolidation function and backend explicitly, for callers that are not deriving them from a fetch.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.Method Summary
All MethodsModifier and TypeMethodDescription(package private) longArchive end time.(package private) RrdBackendFactoryData backend.(package private) URICanonical uri.(package private) ConsolFunConsol fun.(package private) StringDs name.(package private) longFetch step.(package private) RrdDbgetRrdDb()Rrd db.(package private) long[]Rrd timestamps.(package private) double[]Rrd values.(package private) booleanisCompatibleWith(Def def) Is compatible with(package private) booleanisLoaded()Is loaded(package private) voidsetFetchData(FetchData fetchData) Fetch data.Methods inherited from class Source
getName, getTimestamps, getValues, setTimestamps, setValuesModifier and TypeMethodDescription(package private) StringgetName()Returns the source name.(package private) long[]The time, in seconds since the epoch, of each recorded value.(package private) double[]Returns the data values.(package private) voidsetTimestamps(long[] timestamps) Sets the timestamps.(package private) voidsetValues(double[] values) Sets the data values.
Field Details
rrdUri
The RRD file to read.dsName
The data source to read.backend
Backend used to open the file.consolFun
Consolidation function to read with.fetchData
The values fetched from the file.
Constructor Details
Def
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 readfetchData- the fetched values backing this DEF, consulted by the accessors below
Def
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 setdsName- name of the datasource to read within the RRD, which need not match namefetchData- 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 setrrdUri- location of the RRD holding the datasource, in any form the backend acceptsdsName- name of the datasource to read within that RRDconsolFunc- consolidation function (CF) the archive values were produced withbackend- factory that opens the RRD and canonicalises rrdUri
Method Details
getCanonicalUri
getDsName
getConsolFun
ConsolFun getConsolFun()Consol fun.- Returns:
- the consolidation function the archive values were produced with
getBackend
isCompatibleWith
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
setFetchData
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