@Override public byte[] key() { return put.key(); }
/** * Constructor. * @param put Put request to execute if value matches. * @param value The expected value to compare against. * <strong>This byte array will NOT be copied.</strong> */ public CompareAndSetRequest(final PutRequest put, final byte[] expected) { super(put.table(), put.key()); KeyValue.checkValue(expected); this.put = put; this.expected = expected; }
/** Serializes this request for HBase 0.94 and before. */ private ChannelBuffer serializeOld(final byte server_version) { final ChannelBuffer buf = newBuffer(server_version, predictSerializedSize()); buf.writeInt(6); // Number of parameters. // 1st param: byte array: region name. writeHBaseByteArray(buf, region.name()); // 2nd param: byte array: row key. writeHBaseByteArray(buf, put.key()); // 3rd param: byte array: column family. writeHBaseByteArray(buf, put.family()); // 4th param: byte array: qualifier. writeHBaseByteArray(buf, put.qualifier()); // 5th param: byte array: expected value. writeHBaseByteArray(buf, expected); // 6th param: New value. put.serializeInto(buf); return buf; }
final ByteString key = Bytes.wrap(put.key()); final ByteString family = Bytes.wrap(put.family()); final ByteString qualifier = Bytes.wrap(put.qualifier());