blueflood-core/src/main/java/com/rackspacecloud/blueflood/rollup/Granularity.java
public Range deriveRange(int slot, long referenceMillis) {
        // referenceMillis refers to the current time in reference to the range we want to generate from the supplied 
        // slot. This implies that the range we wish to return is before slot(reference).  allow for slot wrapping.
        referenceMillis = snapMillis(referenceMillis);
        int refSlot = slot(referenceMillis);
        int slotDiff = slot > refSlot ? (numSlots() - slot + refSlot) : (refSlot - slot);
        long rangeStart = referenceMillis - slotDiff * milliseconds();
        return new Range(rangeStart, rangeStart + milliseconds() - 1);
    }
public Range deriveRange(int slot, long referenceMillis) {
        // referenceMillis refers to the current time in reference to the range we want to generate from the supplied 
        // slot. This implies that the range we wish to return is before slot(reference).  allow for slot wrapping.
        referenceMillis = snapMillis(referenceMillis);
        int refSlot = slot(referenceMillis);
        int slotDiff = slot > refSlot ? (numSlots() - slot + refSlot) : (refSlot - slot);
        long rangeStart = referenceMillis - slotDiff * milliseconds();
        return new Range(rangeStart, rangeStart + milliseconds() - 1);
    }
public Range deriveRange ( int slot , long referenceMillis ) { // referenceMillis refers to the current time in reference to the range we want to generate from the supplied  // slot. This implies that the range we wish to return is before slot(reference).  allow for slot wrapping. referenceMillis = snapMillis ( referenceMillis ) ; int refSlot = slot ( referenceMillis ) ; int slotDiff = slot > refSlot ? ( numSlots ( ) - slot + refSlot ) : ( refSlot - slot ) ; long rangeStart = referenceMillis - slotDiff * milliseconds ( ) ; return new Range ( rangeStart , rangeStart + milliseconds ( ) - 1 ) ; }
We need to derive ranges (actual times) from slots (which are fixed integers that wrap) when we discover a late
slot. These ranges can be derived from a reference point (which is usually something like now).
@param slot
@param referenceMillis
@return
We need to derive ranges ( actual times ) from slots ( which are fixed integers that wrap ) when we discover a late slot . These ranges can be derived from a reference point ( which is usually something like now ) .