use of com.aerospike.client.Operation in project aerospike-client-java by aerospike.
the class TestOperateHll method assertInit.
public void assertInit(int nIndexBits, int nMinhashBits, boolean shouldPass) {
String msg = "Fail - nIndexBits " + nIndexBits + " nMinhashBits " + nMinhashBits;
HLLPolicy p = HLLPolicy.Default;
Operation[] ops = new Operation[] { HLLOperation.init(p, binName, nIndexBits, nMinhashBits), HLLOperation.getCount(binName), HLLOperation.refreshCount(binName), HLLOperation.describe(binName) };
if (!shouldPass) {
assertThrows(msg, key, AerospikeException.class, ResultCode.PARAMETER_ERROR, ops);
return;
}
Record record = assertSuccess(msg, key, ops);
List<?> resultList = record.getList(binName);
long count = (Long) resultList.get(1);
long count1 = (Long) resultList.get(2);
List<?> description = (List<?>) resultList.get(3);
assertDescription(msg, description, nIndexBits, nMinhashBits);
assertEquals(0, count);
assertEquals(0, count1);
}
use of com.aerospike.client.Operation in project aerospike-client-java by aerospike.
the class ListOperation method get.
/**
* Create list get operation.
* Server returns item at specified index in list bin.
*/
public static Operation get(String binName, int index) {
Packer packer = new Packer();
packer.packRawShort(GET);
packer.packArrayBegin(1);
packer.packInt(index);
byte[] bytes = packer.toByteArray();
return new Operation(Operation.Type.CDT_READ, binName, Value.get(bytes));
}
use of com.aerospike.client.Operation in project aerospike-client-java by aerospike.
the class MapBase method createOperation.
protected static Operation createOperation(int command, Operation.Type type, String binName, Value value, MapReturnType returnType) {
Packer packer = new Packer();
packer.packRawShort(command);
packer.packArrayBegin(2);
packer.packInt(returnType.type);
value.pack(packer);
return new Operation(type, binName, Value.get(packer.toByteArray()));
}
use of com.aerospike.client.Operation in project aerospike-client-java by aerospike.
the class MapBase method createOperation.
protected static Operation createOperation(int command, Operation.Type type, String binName, int index, MapReturnType returnType) {
Packer packer = new Packer();
packer.packRawShort(command);
packer.packArrayBegin(2);
packer.packInt(returnType.type);
packer.packInt(index);
return new Operation(type, binName, Value.get(packer.toByteArray()));
}
use of com.aerospike.client.Operation in project aerospike-client-java by aerospike.
the class MapBase method createOperation.
protected static Operation createOperation(int command, Operation.Type type, String binName, List<Value> value, MapReturnType returnType) {
Packer packer = new Packer();
packer.packRawShort(command);
packer.packArrayBegin(2);
packer.packInt(returnType.type);
packer.packValueList(value);
return new Operation(type, binName, Value.get(packer.toByteArray()));
}
Aggregations