public void logStartRead(DiskRangeList current) { if (log == null) return; int offset = this.offset; if (offset + 1 > log.length) return; log[offset] = makeIntPair(START_READ, current.hasData() ? System.identityHashCode(current.getData()) : 0); this.offset += 1; }
assert !currentNotCached.hasData(); // Assumes no ranges passed to cache to read have data. if (gotAllData != null) { gotAllData.value = false;
public DiskRangeList getIncompleteCbs( DiskRangeList ranges, long baseOffset, BooleanRef gotAllData) { DiskRangeList prev = ranges.prev; if (prev == null) { prev = new MutateHelper(ranges); } DiskRangeList current = ranges; gotAllData.value = true; // Assume by default that we would find everything. while (current != null) { // We assume ranges in "ranges" are non-overlapping; thus, we will save next in advance. DiskRangeList check = current; current = current.next; if (check.hasData()) continue; Integer badLength = cache.get(Long.valueOf(check.getOffset() + baseOffset)); if (badLength == null || badLength < check.getLength()) { gotAllData.value = false; continue; } // We could just remove here and handle the missing tail during read, but that can be // dangerous; let's explicitly add an incomplete CB. check.replaceSelfWith(new IncompleteCb(check.getOffset(), check.getEnd())); } return prev.next; }
long sizeRead = 0; while (drl != null) { assert drl.hasData(); long from = drl.getOffset(), to = drl.getEnd(); int offsetFromReadStart = (int)(from - readStartPos), candidateSize = (int)(to - from); if (candidate.hasData()) { ByteBuffer data = candidate.getData().duplicate(); data.get(array, arrayOffset + offsetFromReadStart, candidateSize);
assert !currentNotCached.hasData(); // Assumes no ranges passed to cache to read have data. if (gotAllData != null) { gotAllData.value = false;
public DiskRangeList getIncompleteCbs( DiskRangeList ranges, long baseOffset, BooleanRef gotAllData) { DiskRangeList prev = ranges.prev; if (prev == null) { prev = new MutateHelper(ranges); } DiskRangeList current = ranges; gotAllData.value = true; // Assume by default that we would find everything. while (current != null) { // We assume ranges in "ranges" are non-overlapping; thus, we will save next in advance. DiskRangeList check = current; current = current.next; if (check.hasData()) continue; Integer badLength = cache.get(Long.valueOf(check.getOffset() + baseOffset)); if (badLength == null || badLength < check.getLength()) { gotAllData.value = false; continue; } // We could just remove here and handle the missing tail during read, but that can be // dangerous; let's explicitly add an incomplete CB. check.replaceSelfWith(new IncompleteCb(check.getOffset(), check.getEnd())); } return prev.next; }
if (range.hasData()) { range = range.next; continue;
if (range.hasData()) { range = range.next; continue;
if (range.hasData()) { range = range.next; continue;
if (range.hasData()) { range = range.next; continue;