use of com.srotya.sidewinder.core.storage.SeriesFieldMap in project sidewinder by srotya.
the class MemStorageEngine method isMeasurementFieldFP.
@Override
public boolean isMeasurementFieldFP(String dbName, String measurementName, String valueFieldName) throws IOException {
if (!checkIfExists(dbName, measurementName)) {
throw NOT_FOUND_EXCEPTION;
}
Map<String, Measurement> dbMap = getOrCreateDatabase(dbName);
// check and create measurement map
Measurement measurement = getOrCreateMeasurement(dbMap, dbName, measurementName);
for (String entry : measurement.getSeriesKeys()) {
SeriesFieldMap seriesFromKey = measurement.getSeriesFromKey(entry);
if (seriesFromKey.get(valueFieldName) != null) {
return seriesFromKey.get(valueFieldName).isFp();
}
}
throw NOT_FOUND_EXCEPTION;
}
use of com.srotya.sidewinder.core.storage.SeriesFieldMap in project sidewinder by srotya.
the class MemoryMeasurement method getOrCreateTimeSeries.
@Override
public TimeSeries getOrCreateTimeSeries(String valueFieldName, List<String> tags, int timeBucketSize, boolean fp, Map<String, String> conf) throws IOException {
Collections.sort(tags);
String seriesId = constructSeriesId(tags, tagIndex);
SeriesFieldMap seriesFieldMap = getSeriesFromKey(seriesId);
if (seriesFieldMap == null) {
lock.lock();
if ((seriesFieldMap = getSeriesFromKey(seriesId)) == null) {
Measurement.indexRowKey(tagIndex, seriesId, tags);
seriesFieldMap = new SeriesFieldMap(seriesId);
seriesMap.put(seriesId, seriesFieldMap);
}
lock.unlock();
}
TimeSeries series = seriesFieldMap.get(valueFieldName);
if (series == null) {
lock.lock();
if ((series = seriesFieldMap.get(valueFieldName)) == null) {
String seriesId2 = seriesId + SERIESID_SEPARATOR + valueFieldName;
series = new TimeSeries(this, compressionCodec, compactionCodec, seriesId2, timeBucketSize, metadata, fp, conf);
seriesFieldMap.addSeries(valueFieldName, series);
logger.fine("Created new timeseries:" + seriesFieldMap + " for measurement:" + measurementName + "\t" + seriesId + "\t" + metadata.getRetentionHours() + "\t" + seriesMap.size());
}
lock.unlock();
}
return series;
}
Aggregations