org.jrobin.core

Class Archive

public class Archive extends Object implements RrdUpdater, ConsolFuns

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 JRobin 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 theese parts.

Method Summary
voidcopyStateTo(RrdUpdater other)
Copies object's internal state to another Archive object.
ArcStategetArcState(int dsIndex)
Returns the underlying archive state object.
longgetArcStep()
Returns archive time step in seconds.
StringgetConsolFun()
Returns archive consolidation function ("AVERAGE", "MIN", "MAX" or "LAST").
longgetEndTime()
Returns current ending timestamp.
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.

Method Detail

copyStateTo

public void copyStateTo(RrdUpdater other)
Copies object's internal state to another Archive object.

Parameters: other New Archive object to copy state to

Throws: IOException Thrown in case of I/O error RrdException Thrown if supplied argument is not an Archive object

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

getArcStep

public long getArcStep()
Returns 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.

getConsolFun

public String getConsolFun()
Returns archive consolidation function ("AVERAGE", "MIN", "MAX" or "LAST").

Returns: Archive consolidation function.

Throws: IOException Thrown in case of I/O error.

getEndTime

public long getEndTime()
Returns 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.

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.

getRows

public int getRows()
Returns the number of archive rows.

Returns: Number of archive rows.

Throws: IOException Thrown in case of I/O error.

getRrdAllocator

public RrdAllocator getRrdAllocator()
Required to implement RrdUpdater interface. You should never call this method directly.

Returns: Allocator object

getRrdBackend

public RrdBackend getRrdBackend()
Returns the underlying storage (backend) object which actually performs all I/O operations.

Returns: I/O backend object

getStartTime

public long getStartTime()
Returns 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.

getSteps

public int getSteps()
Returns the number of archive steps.

Returns: Number of archive steps.

Throws: IOException Thrown in case of I/O error.

getXff

public double getXff()
Returns archive X-files factor.

Returns: Archive X-files factor (between 0 and 1).

Throws: IOException Thrown in case of I/O error.

setXff

public void setXff(double xff)
Sets X-files factor to a new value.

Parameters: xff New X-files factor value. Must be >= 0 and < 1.

Throws: RrdException Thrown if invalid value is supplied IOException Thrown in case of I/O error