public static IncrementOperation build( long storeId, Keyspace keyspace, ByteString key, long delta) { KeyValueAction.Builder b = KeyValueAction.newBuilder(); b.setAction(ActionType.INCREMENT); b.setStoreId(storeId); b.setKeyspaceId(keyspace.getKeyspaceId()); b.setKey(key); b.setValue(ByteString.copyFrom(Value.fromLong(delta).asBytes())); return new IncrementOperation(b.build()); }
public IncrementOperation(KeyValueAction entry) { super(entry); Preconditions.checkArgument(entry.getAction() == ActionType.INCREMENT); Preconditions.checkArgument(entry.hasValue()); }