/** * Returns a list of contiguous time ranges, which fully encapsulate the given * range, provided the range is within the total range of the rollup structure. * * In cases where the rollup structure cannot fully encompass the given range, * as much of the rollup structure as possible will be used to cover the range. * * The resulting ranges are all of the same duration (the largest granularity). */ List<TimeRange> getEncompassingRanges(TimeRange range) { List<FrozenGranularityLayer> l = struct.getFrozenLayers(); FrozenGranularityLayer largest = l.get(l.size() - 1); TimeRange fillRange = range.augmentToOverlapWith(largest.getGranularity()); return largest.fillRange(fillRange); } }
/** * Returns a map from granularity to the oldest datapoint which should * exist for it. */ GranularityTimes getOldestAllowedTimeForGranularity() { Time now = timeSvc.nowNanoTime(); FrozenRollUpStructure frozenStruct = this.struct.freeze(now); GranularityTimes res = new GranularityTimes(); for (FrozenGranularityLayer layer : frozenStruct.getFrozenLayers()) { res.put(layer.getGranularity(), layer.getTotalRange().getStartTime()); } return res; }