/** * Sets datasource name to a new value * * @param newDsName New datasource name * @throws java.io.IOException Thrown in case of I/O error */ public void setDsName(String newDsName) throws IOException { if (parentDb.containsDs(newDsName)) { throw new IllegalArgumentException("Datasource already defined in this RRD: " + newDsName); } this.dsName.set(newDsName); }
/** * Sets datasource name to a new value * * @param newDsName New datasource name * @throws IOException Thrown in case of I/O error */ public void setDsName(String newDsName) throws IOException { if (newDsName != null && newDsName.length() > RrdString.STRING_LENGTH) { throw new IllegalArgumentException("Invalid datasource name specified: " + newDsName); } if (parentDb.containsDs(newDsName)) { throw new IllegalArgumentException("Datasource already defined in this RRD: " + newDsName); } this.dsName.set(newDsName); }
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()); }
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, 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()); }
public void setDsType(DsType newDsType) throws IOException { // set datasource type this.dsType.set(newDsType.name()); // reset datasource status lastValue.set(Double.NaN); accumValue.set(0.0); // reset archive status int dsIndex = parentDb.getDsIndex(dsName.get()); Archive[] archives = parentDb.getArchives(); for (Archive archive : archives) { archive.getArcState(dsIndex).setAccumValue(Double.NaN); } }
Datasource(RrdDb parentDb, DsDef dsDef) throws IOException { boolean shouldInitialize = dsDef != null; this.parentDb = parentDb; dsName = new RrdString(this); dsType = new RrdString(this); heartbeat = new RrdLong(this); minValue = new RrdDouble(this); maxValue = new RrdDouble(this); lastValue = new RrdDouble(this); accumValue = new RrdDouble(this); nanSeconds = new RrdLong(this); if (shouldInitialize) { dsName.set(dsDef.getDsName()); dsType.set(dsDef.getDsType().name()); heartbeat.set(dsDef.getHeartbeat()); minValue.set(dsDef.getMinValue()); maxValue.set(dsDef.getMaxValue()); lastValue.set(Double.NaN); accumValue.set(0.0); Header header = parentDb.getHeader(); nanSeconds.set(header.getLastUpdateTime() % header.getStep()); } }
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()); } }
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()); } }
Datasource(RrdDb parentDb, DsDef dsDef) throws IOException { boolean shouldInitialize = dsDef != null; this.parentDb = parentDb; dsName = new RrdString<>(this); dsType = new RrdEnum<>(this, DsType.class); heartbeat = new RrdLong<>(this); minValue = new RrdDouble<>(this); maxValue = new RrdDouble<>(this); lastValue = new RrdDouble<>(this); accumValue = new RrdDouble<>(this); nanSeconds = new RrdLong<>(this); accumLastValue = Double.NaN; if (shouldInitialize) { dsName.set(dsDef.getDsName()); dsType.set(dsDef.getDsType()); heartbeat.set(dsDef.getHeartbeat()); minValue.set(dsDef.getMinValue()); maxValue.set(dsDef.getMaxValue()); lastValue.set(Double.NaN); accumValue.set(0.0); Header header = parentDb.getHeader(); nanSeconds.set(header.getLastUpdateTime() % header.getStep()); } }
boolean shouldInitialize = arcDef != null; if (shouldInitialize) { consolFun.set(arcDef.getConsolFun().name()); xff.set(arcDef.getXff()); steps.set(arcDef.getSteps());