@Override public Buffer readSegment(long msb, long lsb) throws IOException { AzureSegmentArchiveEntry indexEntry = index.get(new UUID(msb, lsb)); if (indexEntry == null) { return null; } Buffer buffer; if (OFF_HEAP) { buffer = Buffer.allocateDirect(indexEntry.getLength()); } else { buffer = Buffer.allocate(indexEntry.getLength()); } ioMonitor.beforeSegmentRead(pathAsFile(), msb, lsb, indexEntry.getLength()); Stopwatch stopwatch = Stopwatch.createStarted(); readBufferFully(getBlob(getSegmentFileName(indexEntry)), buffer); long elapsed = stopwatch.elapsed(TimeUnit.NANOSECONDS); ioMonitor.afterSegmentRead(pathAsFile(), msb, lsb, indexEntry.getLength(), elapsed); return buffer; }
@Override public Buffer readSegment(long msb, long lsb) throws IOException { AzureSegmentArchiveEntry indexEntry = index.get(new UUID(msb, lsb)); if (indexEntry == null) { return null; } Buffer buffer; if (OFF_HEAP) { buffer = Buffer.allocateDirect(indexEntry.getLength()); } else { buffer = Buffer.allocate(indexEntry.getLength()); } ioMonitor.beforeSegmentRead(pathAsFile(), msb, lsb, indexEntry.getLength()); Stopwatch stopwatch = Stopwatch.createStarted(); readBufferFully(getBlob(getSegmentFileName(indexEntry)), buffer); long elapsed = stopwatch.elapsed(TimeUnit.NANOSECONDS); ioMonitor.afterSegmentRead(pathAsFile(), msb, lsb, indexEntry.getLength(), elapsed); return buffer; }
@Override public Buffer readSegment(long msb, long lsb) throws IOException { UUID uuid = new UUID(msb, lsb); Optional<SegmentWriteAction> segment = queue.map(q -> q.read(uuid)); if (segment.isPresent()) { return segment.get().toBuffer(); } AzureSegmentArchiveEntry indexEntry = index.get(new UUID(msb, lsb)); if (indexEntry == null) { return null; } Buffer buffer; if (OFF_HEAP) { buffer = Buffer.allocateDirect(indexEntry.getLength()); } else { buffer = Buffer.allocate(indexEntry.getLength()); } readBufferFully(getBlob(getSegmentFileName(indexEntry)), buffer); return buffer; }
@Override public Buffer readSegment(long msb, long lsb) throws IOException { UUID uuid = new UUID(msb, lsb); Optional<SegmentWriteAction> segment = queue.map(q -> q.read(uuid)); if (segment.isPresent()) { return segment.get().toBuffer(); } AzureSegmentArchiveEntry indexEntry = index.get(new UUID(msb, lsb)); if (indexEntry == null) { return null; } Buffer buffer; if (OFF_HEAP) { buffer = Buffer.allocateDirect(indexEntry.getLength()); } else { buffer = Buffer.allocate(indexEntry.getLength()); } readBufferFully(getBlob(getSegmentFileName(indexEntry)), buffer); return buffer; }