blueflood-rollupTools/src/main/java/com/rackspacecloud/blueflood/CloudFilesBackfiller/rollup/handlers/BuildStore.java
public static Map<Range, ConcurrentHashMap<Locator, Points>> getEligibleData() {
        if (locatorToTimestampToPoint.size() <= RANGE_BUFFER) {
            log.debug("Range buffer still not exceeded. Returning null data to rollup generator");
            return null;
        } else {
            Object[] sortedKeySet = locatorToTimestampToPoint.keySet().toArray();
            Range cuttingPoint = (Range) sortedKeySet[sortedKeySet.length - RANGE_BUFFER - 1];
            log.info("Found completed ranges up to the threshold range of {}", cuttingPoint);
            completedRangesReturned.mark();
            return locatorToTimestampToPoint.headMap(cuttingPoint, true);
        }
    }
public static Map<Range, ConcurrentHashMap<Locator, Points>> getEligibleData() {
        if (locatorToTimestampToPoint.size() <= RANGE_BUFFER) {
            log.debug("Range buffer still not exceeded. Returning null data to rollup generator");
            return null;
        } else {
            Object[] sortedKeySet = locatorToTimestampToPoint.keySet().toArray();
            Range cuttingPoint = (Range) sortedKeySet[sortedKeySet.length - RANGE_BUFFER - 1];
            log.info("Found completed ranges up to the threshold range of {}", cuttingPoint);
            completedRangesReturned.mark();
            return locatorToTimestampToPoint.headMap(cuttingPoint, true);
        }
    }
/*
Consider 5 files getting merged in the buildstore. Assuming the flush rate to be 1 file/min, we need all the files together in order to construct 5 min rollup
How are we going to decide that a particular range has been totally filled up and ready to be rolled?
One behaviour which we will start seeing in the buildstore is "higher" ranges starting to build up. This means the current range has almost filled up.
But there is still a possibility for backed up data, getting merged. So we provide RANGE_BUFFER.
Basically, for every call to getEligibleData, it is going to return (n-RANGE_BUFFER) ranges to get rolled up, and keep (RANGE_BUFFER) in buildstore
Also, note that returning the range, will eventually remove them from buildstore, after all rollups are completed in RollupGenerator for that range.