/** * @param pageAddr Page address. * @return Direct count. */ private int getDirectCount(long pageAddr) { return PageUtils.getByte(pageAddr, DIRECT_CNT_OFF) & 0xFF; }
/** * @param pageAddr Page address. * @return Indirect count. */ private int getIndirectCount(long pageAddr) { return PageUtils.getByte(pageAddr, INDIRECT_CNT_OFF) & 0xFF; }
/** * @param pageAddr Page address. */ private boolean getLastFlag(long pageAddr) { return PageUtils.getByte(pageAddr, LAST_FLAG_OFF) == LAST_FLAG; }
/** {@inheritDoc} */ @Override public byte getState(long pageAddr, int off) { return PageUtils.getByte(pageAddr, off + 16); }
/** * @param pageAddr Page address. */ public byte getPartitionState(long pageAddr) { return PageUtils.getByte(pageAddr, PARTITION_STATE_OFF); }
/** {@inheritDoc} */ @Override public byte getState(long pageAddr, int off) { return PageUtils.getByte(pageAddr, off + 16); }
/** * @param pageAddr Page address. * @return Number of levels in this tree. */ public int getLevelsCount(long pageAddr) { return Byte.toUnsignedInt(PageUtils.getByte(pageAddr, LVLS_OFF)); }
/** * @param pageAddr Page address. * @param off Offset. * @return Full size in page. */ public int fullSize(long pageAddr, int off) { int type = PageUtils.getByte(pageAddr, off); if (type == Value.NULL) return 1; if (size > 0) return size + 1; else return PageUtils.getShort(pageAddr, off + 1) + 3; }
/** * Gets needed buffer size to read the whole version instance. * Does not change buffer position. * * @param pageAddr Page address. * @param allowNull Is {@code null} version allowed. * @return Size of serialized version. * @throws IgniteCheckedException If failed. */ public static int readSize(long pageAddr, boolean allowNull) throws IgniteCheckedException { byte protoVer = checkProtocolVersion(PageUtils.getByte(pageAddr, 0), allowNull); return sizeForVersion(protoVer); }
/** {@inheritDoc} */ @Override protected int compare(final BPlusIO<IndexItem> io, final long pageAddr, final int idx, final IndexItem row) throws IgniteCheckedException { final int off = ((IndexIO)io).getOffset(pageAddr, idx); int shift = 0; // Compare index names. final int len = PageUtils.getUnsignedByte(pageAddr, off + shift); shift += BYTE_LEN; for (int i = 0; i < len && i < row.idxName.length; i++) { final int cmp = Byte.compare(PageUtils.getByte(pageAddr, off + i + shift), row.idxName[i]); if (cmp != 0) return cmp; } return Integer.compare(len, row.idxName.length); }
/** * @param pageAddr Page address. * @param off Offset. * @param v Value to compare. * @param type Highest value type. * @return Compare result ({@code Integer.MIN_VALUE} means unsupported operation. */ private int compareAsUUID(long pageAddr, int off, Value v, int type) { // only compatible types are supported now. if(PageUtils.getByte(pageAddr, off) == type) { assert type == Value.UUID; ValueUuid uuid = (ValueUuid)v.convertTo(Value.UUID); long long1 = PageUtils.getLong(pageAddr, off + 1); int c = Long.compare(long1, uuid.getHigh()); if(c != 0) return fixSort(c, sortType()); long1 = PageUtils.getLong(pageAddr, off + 9); c = Long.compare(long1, uuid.getLow()); return fixSort(c, sortType()); } return Integer.MIN_VALUE; }
/** * @param mem Page memory. * @param pageId Page ID. * @param page Page pointer. * @param expVal Expected value. */ private void readPage(PageMemory mem, long pageId, long page, int expVal) { expVal &= 0xFF; long pageAddr = mem.readLock(-1, pageId, page); assert pageAddr != 0; try { for (int i = PageIO.COMMON_HEADER_END; i < PAGE_SIZE; i++) { int val = PageUtils.getByte(pageAddr, i) & 0xFF; assertEquals("Unexpected value at position: " + i, expVal, val); } } finally { mem.readUnlock(-1, pageId, page); } }
if(PageUtils.getByte(pageAddr, off) == type) { switch (type) { case Value.TIME:
|| (type = PageUtils.getByte(pageAddr, off)) == Value.UNKNOWN) return CANT_BE_COMPARE;
byte protoVer = checkProtocolVersion(PageUtils.getByte(pageAddr, 0), allowNull);
byte b1 = PageUtils.getByte(addr, i); byte b2 = bytes[i];
for (int i = PageIO.COMMON_HEADER_END; i < mem.realPageSize(fullId.groupId()); i++) { int expState = state & 0xFF; int pageState = PageUtils.getByte(pageAddr, i) & 0xFF; int walState = walData[i] & 0xFF;