public static boolean matchingValue(final Cell left, final Cell right) { return Bytes.equals( left.getValueArray(), left.getValueOffset(), left.getValueLength(), right.getValueArray(), right.getValueOffset(), right.getValueLength()); }
/** @deprecated use MetaTableAccessor methods for interacting with meta layouts */ @Deprecated public static ServerName getServerName(final Result r) { Cell cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER); if (cell == null || cell.getValueLength() == 0) return null; String hostAndPort = Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER); if (cell == null || cell.getValueLength() == 0) return null; try { return ServerName.valueOf( hostAndPort, Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } catch (IllegalArgumentException e) { LOG.error("Ignoring invalid region for server " + hostAndPort + "; cell=" + cell, e); return null; } }
public static int copyValueTo(Cell cell, byte[] destination, int destinationOffset) { System.arraycopy( cell.getValueArray(), cell.getValueOffset(), destination, destinationOffset, cell.getValueLength()); return destinationOffset + cell.getValueLength(); }
/** * The latest seqnum that the server writing to meta observed when opening the region. E.g. the * seqNum when the result of {@link #getServerName(Result)} was written. * * @param r Result to pull the seqNum from * @return SeqNum, or HConstants.NO_SEQNUM if there's no value written. * @deprecated use MetaTableAccessor methods for interacting with meta layouts */ @Deprecated public static long getSeqNumDuringOpen(final Result r) { Cell cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, HConstants.SEQNUM_QUALIFIER); if (cell == null || cell.getValueLength() == 0) return HConstants.NO_SEQNUM; return Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); }
/** * Returns the HRegionInfo object from the column {@link HConstants#CATALOG_FAMILY} and <code> * qualifier</code> of the catalog table result. * * @param r a Result object from the catalog table scan * @param qualifier Column family qualifier -- either {@link HConstants#SPLITA_QUALIFIER}, {@link * HConstants#SPLITB_QUALIFIER} or {@link HConstants#REGIONINFO_QUALIFIER}. * @return An HRegionInfo instance or null. * @deprecated use MetaTableAccessor methods for interacting with meta layouts */ @Deprecated public static HRegionInfo getHRegionInfo(final Result r, byte[] qualifier) { Cell cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, qualifier); if (cell == null) return null; return parseFromOrNull(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); }
public static boolean matchingValue(final Cell left, final byte[] buf) { return Bytes.equals( left.getValueArray(), left.getValueOffset(), left.getValueLength(), buf, 0, buf.length); }
public static ByteBuffer getValueBufferShallowCopy(Cell cell) { ByteBuffer buffer = ByteBuffer.wrap(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); return buffer; }