void setNanSteps(long value) throws IOException { nanSteps.set(value); }
void setLastUpdateTime(long lastUpdateTime) throws IOException { this.lastUpdateTime.set(lastUpdateTime); }
void setLastUpdateTime(long lastUpdateTime) throws IOException { this.lastUpdateTime.set(lastUpdateTime); }
void setNanSteps(long value) throws IOException { nanSteps.set(value); }
/** * Sets datasource heartbeat to a new value. * * @param heartbeat New heartbeat value * @throws java.io.IOException Thrown in case of I/O error * @throws java.lang.IllegalArgumentException Thrown if invalid (non-positive) heartbeat value is specified. */ public void setHeartbeat(long heartbeat) throws IOException { if (heartbeat < 1L) { throw new IllegalArgumentException("Invalid heartbeat specified: " + heartbeat); } this.heartbeat.set(heartbeat); }
/** * Sets datasource heartbeat to a new value. * * @param heartbeat New heartbeat value * @throws IOException Thrown in case of I/O error * @throws IllegalArgumentException Thrown if invalid (non-positive) heartbeat value is specified. */ public void setHeartbeat(long heartbeat) throws IOException { if (heartbeat < 1L) { throw new IllegalArgumentException("Invalid heartbeat specified: " + heartbeat); } this.heartbeat.set(heartbeat); }
/** * {@inheritDoc} * * Copies object's internal state to another Header object. */ public void copyStateTo(Header header) throws IOException { header.lastUpdateTime.set(lastUpdateTime.get()); }
/** * Copies object's internal state to another Header object. * * @param other New Header object to copy state to * @throws IOException Thrown in case of I/O error */ public void copyStateTo(RrdUpdater other) throws IOException { if (!(other instanceof Header)) { throw new IllegalArgumentException( "Cannot copy Header object to " + other.getClass().getName()); } Header header = (Header) other; //header.signature.set(signature.get()); header.lastUpdateTime.set(lastUpdateTime.get()); }
/** * Copies object's internal state to another ArcState object. * * @param other New ArcState object to copy state to * @throws IOException Thrown in case of I/O error */ public void copyStateTo(RrdUpdater other) throws IOException { if (!(other instanceof ArcState)) { throw new IllegalArgumentException("Cannot copy ArcState object to " + other.getClass().getName()); } ArcState arcState = (ArcState) other; arcState.accumValue.set(accumValue.get()); arcState.nanSteps.set(nanSteps.get()); }
private void accumulate(long oldTime, long newTime, double updateValue) throws IOException { if (Double.isNaN(updateValue)) { nanSeconds.set(nanSeconds.get() + (newTime - oldTime)); } else { accumValue.set(accumValue.get() + updateValue * (newTime - oldTime)); accumLastValue = updateValue; } }
private void accumulate(long oldTime, long newTime, double updateValue) throws IOException { if (Double.isNaN(updateValue)) { nanSeconds.set(nanSeconds.get() + (newTime - oldTime)); } else { accumValue.set(accumValue.get() + updateValue * (newTime - oldTime)); } }
/** * {@inheritDoc} * * Copies object's internal state to another ArcState object. */ public void copyStateTo(ArcState arcState) throws IOException { arcState.accumValue.set(accumValue.get()); arcState.nanSteps.set(nanSteps.get()); }
Header(RrdDb parentDb, DataImporter reader) throws IOException { this(parentDb, (RrdDef) null); String version = reader.getVersion(); if (!RRDTOOL_VERSION.equals(version)) { throw new IllegalArgumentException("Could not unserialize xml version " + version); } signature.set(DEFAULT_SIGNATURE); step.set(reader.getStep()); dsCount.set(reader.getDsCount()); arcCount.set(reader.getArcCount()); lastUpdateTime.set(reader.getLastUpdateTime()); }
Header(RrdDb parentDb, DataImporter reader) throws IOException { this(parentDb, (RrdDef) null); String importVersion = reader.getVersion(); switch(importVersion) { case RRDTOOL_VERSION1: version = 1; break; case RRDTOOL_VERSION3: version = 2; break; default: throw new IllegalArgumentException("Could not get version " + version); } signature.set(SIGNATURE + ", " + VERSIONS[version - 1]); step.set(reader.getStep()); dsCount.set(reader.getDsCount()); arcCount.set(reader.getArcCount()); lastUpdateTime.set(reader.getLastUpdateTime()); }
/** * {@inheritDoc} * * Copies object's internal state to another Datasource object. */ public void copyStateTo(Datasource datasource) throws IOException { if (!datasource.dsName.get().equals(dsName.get())) { throw new IllegalArgumentException("Incompatible datasource names"); } if (datasource.dsType.get() != dsType.get()) { throw new IllegalArgumentException("Incompatible datasource types"); } datasource.lastValue.set(lastValue.get()); datasource.nanSeconds.set(nanSeconds.get()); datasource.accumValue.set(accumValue.get()); }
Datasource(RrdDb parentDb, DataImporter reader, int dsIndex) throws IOException { this(parentDb, null); dsName.set(reader.getDsName(dsIndex)); dsType.set(reader.getDsType(dsIndex)); heartbeat.set(reader.getHeartbeat(dsIndex)); minValue.set(reader.getMinValue(dsIndex)); maxValue.set(reader.getMaxValue(dsIndex)); lastValue.set(reader.getLastValue(dsIndex)); accumValue.set(reader.getAccumValue(dsIndex)); nanSeconds.set(reader.getNanSeconds(dsIndex)); }
Datasource(RrdDb parentDb, DataImporter reader, int dsIndex) throws IOException { this(parentDb, null); dsName.set(reader.getDsName(dsIndex)); dsType.set(reader.getDsType(dsIndex)); heartbeat.set(reader.getHeartbeat(dsIndex)); minValue.set(reader.getMinValue(dsIndex)); maxValue.set(reader.getMaxValue(dsIndex)); lastValue.set(reader.getLastValue(dsIndex)); accumValue.set(reader.getAccumValue(dsIndex)); nanSeconds.set(reader.getNanSeconds(dsIndex)); }
Header(RrdDb parentDb, RrdDef rrdDef) throws IOException { this.parentDb = parentDb; String initSignature = null; if(rrdDef != null) { version = rrdDef.getVersion(); initSignature = SIGNATURE + ", " + VERSIONS[version - 1]; } else { initSignature = DEFAULT_SIGNATURE; } signature = new RrdString<>(this); // NOT constant, may be cached step = new RrdLong<>(this, true); // constant, may be cached dsCount = new RrdInt<>(this, true); // constant, may be cached arcCount = new RrdInt<>(this, true); // constant, may be cached lastUpdateTime = new RrdLong<>(this); if (rrdDef != null) { signature.set(initSignature); step.set(rrdDef.getStep()); dsCount.set(rrdDef.getDsCount()); arcCount.set(rrdDef.getArcCount()); lastUpdateTime.set(rrdDef.getStartTime()); } }
ArcState(Archive parentArc, boolean shouldInitialize) throws IOException { this.parentArc = parentArc; accumValue = new RrdDouble<>(this); nanSteps = new RrdLong<>(this); if (shouldInitialize) { Header header = parentArc.getParentDb().getHeader(); long step = header.getStep(); long lastUpdateTime = header.getLastUpdateTime(); long arcStep = parentArc.getArcStep(); long initNanSteps = (Util.normalize(lastUpdateTime, step) - Util.normalize(lastUpdateTime, arcStep)) / step; accumValue.set(Double.NaN); nanSteps.set(initNanSteps); } }
ArcState(Archive parentArc, boolean shouldInitialize) throws IOException { this.parentArc = parentArc; accumValue = new RrdDouble(this); nanSteps = new RrdLong(this); if (shouldInitialize) { Header header = parentArc.getParentDb().getHeader(); long step = header.getStep(); long lastUpdateTime = header.getLastUpdateTime(); long arcStep = parentArc.getArcStep(); long initNanSteps = (Util.normalize(lastUpdateTime, step) - Util.normalize(lastUpdateTime, arcStep)) / step; accumValue.set(Double.NaN); nanSteps.set(initNanSteps); } }