int len = CACHE_BLOCK_SIZE - off; len = Math.min(len, dst.remaining()); ByteBuffer buff = cache.get(cachePos); if (buff == null) { buff = ByteBuffer.allocate(CACHE_BLOCK_SIZE);
/** * Read a page. * * @param map the map * @param pos the page position * @return the page */ Page readPage(MVMap<?, ?> map, long pos) { if (pos == 0) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_FILE_CORRUPT, "Position 0"); } Page p = cache == null ? null : cache.get(pos); if (p == null) { Chunk c = getChunk(pos); long filePos = c.block * BLOCK_SIZE; filePos += DataUtils.getPageOffset(pos); if (filePos < 0) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_FILE_CORRUPT, "Negative position {0}", filePos); } long maxPos = (c.block + c.len) * BLOCK_SIZE; p = Page.read(fileStore, pos, map, filePos, maxPos); cachePage(pos, p, p.getMemory()); } return p; }
int len = CACHE_BLOCK_SIZE - off; len = Math.min(len, dst.remaining()); ByteBuffer buff = cache.get(cachePos); if (buff == null) { buff = ByteBuffer.allocate(CACHE_BLOCK_SIZE);
int len = CACHE_BLOCK_SIZE - off; len = Math.min(len, dst.remaining()); ByteBuffer buff = cache.get(cachePos); if (buff == null) { buff = ByteBuffer.allocate(CACHE_BLOCK_SIZE);
int len = CACHE_BLOCK_SIZE - off; len = Math.min(len, dst.remaining()); ByteBuffer buff = cache.get(cachePos); if (buff == null) { buff = ByteBuffer.allocate(CACHE_BLOCK_SIZE);
/** {@inheritDoc} */ @Override public GridH2KeyValueRowOffheap createPointer(long ptr) { GridH2KeyValueRowOffheap row = rowCache.get(ptr); if (row != null) { assert row.pointer() == ptr : ptr + " " + row.pointer(); return row; } return new GridH2KeyValueRowOffheap(this, ptr); } }
/** * Read a page. * * @param map the map * @param pos the page position * @return the page */ Page readPage(MVMap<?, ?> map, long pos) { if (pos == 0) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_FILE_CORRUPT, "Position 0"); } Page p = cache == null ? null : cache.get(pos); if (p == null) { Chunk c = getChunk(pos); long filePos = c.block * BLOCK_SIZE; filePos += DataUtils.getPageOffset(pos); if (filePos < 0) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_FILE_CORRUPT, "Negative position {0}", filePos); } long maxPos = (c.block + c.len) * BLOCK_SIZE; p = Page.read(fileStore, pos, map, filePos, maxPos); cachePage(pos, p, p.getMemory()); } return p; }
/** * Read a page. * * @param map the map * @param pos the page position * @return the page */ Page readPage(MVMap<?, ?> map, long pos) { if (pos == 0) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_FILE_CORRUPT, "Position 0"); } Page p = cache == null ? null : cache.get(pos); if (p == null) { Chunk c = getChunk(pos); long filePos = c.block * BLOCK_SIZE; filePos += DataUtils.getPageOffset(pos); if (filePos < 0) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_FILE_CORRUPT, "Negative position {0}", filePos); } long maxPos = (c.block + c.len) * BLOCK_SIZE; p = Page.read(fileStore, pos, map, filePos, maxPos); cachePage(pos, p, p.getMemory()); } return p; }
/** * Read a page. * * @param map the map * @param pos the page position * @return the page */ Page readPage(MVMap<?, ?> map, long pos) { if (pos == 0) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_FILE_CORRUPT, "Position 0"); } Page p = cache == null ? null : cache.get(pos); if (p == null) { Chunk c = getChunk(pos); long filePos = c.block * BLOCK_SIZE; filePos += DataUtils.getPageOffset(pos); if (filePos < 0) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_FILE_CORRUPT, "Negative position {0}", filePos); } long maxPos = (c.block + c.len) * BLOCK_SIZE; p = Page.read(fileStore, pos, map, filePos, maxPos); cachePage(pos, p, p.getMemory()); } return p; }