Package org.rrd4j.core
Class Archive
- java.lang.Object
-
- org.rrd4j.core.Archive
-
- All Implemented Interfaces:
RrdUpdater<Archive>
public class Archive extends Object implements RrdUpdater<Archive>
Class to represent single RRD archive in a RRD with its internal state. Normally, you don't need methods to manipulate archive objects directly because Rrd4j framework does it automatically for you.Each archive object consists of three parts: archive definition, archive state objects (one state object for each datasource) and round robin archives (one round robin for each datasource). API (read-only) is provided to access each of these parts.
- Author:
- Sasa Markovic
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidappendXml(XmlWriter writer)(package private) voidarchive(int dsIndex, double value, long numUpdates)voidcopyStateTo(Archive arc)copyStateTo.(package private) Stringdump()(package private) FetchDatafetchData(FetchRequest request)ArcStategetArcState(int dsIndex)Returns the underlying archive state object.longgetArcStep()Returns archive time step in seconds.ConsolFungetConsolFun()Returns archive consolidation function ("AVERAGE", "MIN", "MAX", "FIRST", "LAST" or "TOTAL").longgetEndTime()Returns current ending timestamp.(package private) RrdDbgetParentDb()RobingetRobin(int dsIndex)Returns the underlying round robin archive.intgetRows()Returns the number of archive rows.RrdAllocatorgetRrdAllocator()Required to implement RrdUpdater interface.RrdBackendgetRrdBackend()Returns the underlying storage (backend) object which actually performs all I/O operations.longgetStartTime()Returns current starting timestamp.intgetSteps()Returns the number of archive steps.doublegetXff()Returns archive X-files factor.voidsetXff(double xff)Sets X-files factor to a new value.
-
-
-
Constructor Detail
-
Archive
Archive(RrdDb parentDb, ArcDef arcDef) throws IOException
- Throws:
IOException
-
Archive
Archive(RrdDb parentDb, DataImporter reader, int arcIndex) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getArcStep
public long getArcStep() throws IOExceptionReturns archive time step in seconds. Archive step is equal to RRD step multiplied with the number of archive steps.- Returns:
- Archive time step in seconds
- Throws:
IOException- Thrown in case of I/O error.
-
dump
String dump() throws IOException
- Throws:
IOException
-
getParentDb
RrdDb getParentDb()
-
archive
void archive(int dsIndex, double value, long numUpdates) throws IOException- Throws:
IOException
-
getConsolFun
public ConsolFun getConsolFun() throws IOException
Returns archive consolidation function ("AVERAGE", "MIN", "MAX", "FIRST", "LAST" or "TOTAL").- Returns:
- Archive consolidation function.
- Throws:
IOException- Thrown in case of I/O error.
-
getXff
public double getXff() throws IOExceptionReturns archive X-files factor.- Returns:
- Archive X-files factor (between 0 and 1).
- Throws:
IOException- Thrown in case of I/O error.
-
getSteps
public int getSteps() throws IOExceptionReturns the number of archive steps.- Returns:
- Number of archive steps.
- Throws:
IOException- Thrown in case of I/O error.
-
getRows
public int getRows() throws IOExceptionReturns the number of archive rows.- Returns:
- Number of archive rows.
- Throws:
IOException- Thrown in case of I/O error.
-
getStartTime
public long getStartTime() throws IOExceptionReturns current starting timestamp. This value is not constant.- Returns:
- Timestamp corresponding to the first archive row
- Throws:
IOException- Thrown in case of I/O error.
-
getEndTime
public long getEndTime() throws IOExceptionReturns current ending timestamp. This value is not constant.- Returns:
- Timestamp corresponding to the last archive row
- Throws:
IOException- Thrown in case of I/O error.
-
getArcState
public ArcState getArcState(int dsIndex)
Returns the underlying archive state object. Each datasource has its corresponding ArcState object (archive states are managed independently for each RRD datasource).- Parameters:
dsIndex- Datasource index- Returns:
- Underlying archive state object
-
getRobin
public Robin getRobin(int dsIndex)
Returns the underlying round robin archive. Robins are used to store actual archive values on a per-datasource basis.- Parameters:
dsIndex- Index of the datasource in the RRD.- Returns:
- Underlying round robin archive for the given datasource.
-
fetchData
FetchData fetchData(FetchRequest request) throws IOException
- Throws:
IOException
-
appendXml
void appendXml(XmlWriter writer) throws IOException
- Throws:
IOException
-
copyStateTo
public void copyStateTo(Archive arc) throws IOException
copyStateTo.
Copies object's internal state to another Archive object.- Specified by:
copyStateToin interfaceRrdUpdater<Archive>- Parameters:
arc- aRrdUpdaterobject.- Throws:
IOException- if any.
-
setXff
public void setXff(double xff) throws IOExceptionSets X-files factor to a new value.- Parameters:
xff- New X-files factor value. Must be >= 0 and < 1.- Throws:
IOException- Thrown in case of I/O error
-
getRrdBackend
public RrdBackend getRrdBackend()
Returns the underlying storage (backend) object which actually performs all I/O operations.- Specified by:
getRrdBackendin interfaceRrdUpdater<Archive>- Returns:
- I/O backend object
-
getRrdAllocator
public RrdAllocator getRrdAllocator()
Required to implement RrdUpdater interface. You should never call this method directly.- Specified by:
getRrdAllocatorin interfaceRrdUpdater<Archive>- Returns:
- Allocator object
-
-