/** * Gets the range end of the given prefix. * * <p>The range end is the key plus one (e.g., "aa"+1 == "ab", "a\xff"+1 == "b"). * * @param prefix the given prefix * @return the range end of the given prefix */ public static ByteSequence PrefixEndOf(ByteSequence prefix) { byte[] endKey = (byte[])prefix.getBytes().Clone(); for (int i = endKey.Length - 1; i >= 0; i--) { if (endKey[i] < 0xff) { endKey[i] = (byte)(endKey[i] + 1); byte[] dest = new byte[endKey.Length - i - 1]; Array.Copy(endKey, i + 1, dest, 0, dest.Length); return(ByteSequence.from(dest)); } } return(ByteSequence.from(NO_PREFIX_END)); }
/** * Cmp on the <i>value</i>. * * @param value the value to compare * @return the value compare target */ public static ValueCmpTarget Value(ByteSequence value) { return(new ValueCmpTarget(ByteString.CopyFrom(value.getBytes()))); }
public Cmp(ByteSequence key, Op compareOp, CmpTarget <T> target) { this.key = ByteString.CopyFrom(key.getBytes()); this.op = compareOp; this.target = target; }
public static DeleteOp delete(ByteSequence key, DeleteOption option) { return(new DeleteOp(ByteString.CopyFrom(key.getBytes()), option)); }
public static GetOp get(ByteSequence key, GetOption option) { return(new GetOp(ByteString.CopyFrom(key.getBytes()), option)); }
public static PutOp Put(ByteSequence key, ByteSequence value, PutOption option) { return(new PutOp(ByteString.CopyFrom(key.getBytes()), ByteString.CopyFrom(value.getBytes()), option)); }