Search in sources :

Example 31 with Operation

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);
}
Also used : Record(com.aerospike.client.Record) ArrayList(java.util.ArrayList) List(java.util.List) Operation(com.aerospike.client.Operation) HLLOperation(com.aerospike.client.operation.HLLOperation) HLLPolicy(com.aerospike.client.operation.HLLPolicy)

Example 32 with Operation

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));
}
Also used : Operation(com.aerospike.client.Operation) Packer(com.aerospike.client.util.Packer)

Example 33 with Operation

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()));
}
Also used : Operation(com.aerospike.client.Operation) Packer(com.aerospike.client.util.Packer)

Example 34 with Operation

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()));
}
Also used : Operation(com.aerospike.client.Operation) Packer(com.aerospike.client.util.Packer)

Example 35 with Operation

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()));
}
Also used : Operation(com.aerospike.client.Operation) Packer(com.aerospike.client.util.Packer)

Aggregations

Operation (com.aerospike.client.Operation)51 Packer (com.aerospike.client.util.Packer)36 Record (com.aerospike.client.Record)6 ArrayList (java.util.ArrayList)6 Key (com.aerospike.client.Key)5 BatchRead (com.aerospike.client.BatchRead)4 CommandExp (com.aerospike.client.exp.CommandExp)4 ListOperation (com.aerospike.client.cdt.ListOperation)3 ExpOperation (com.aerospike.client.exp.ExpOperation)3 Expression (com.aerospike.client.exp.Expression)3 HLLOperation (com.aerospike.client.operation.HLLOperation)3 HLLPolicy (com.aerospike.client.operation.HLLPolicy)3 List (java.util.List)2 Test (org.junit.Test)2 AerospikeException (com.aerospike.client.AerospikeException)1 Bin (com.aerospike.client.Bin)1 Value (com.aerospike.client.Value)1 HLLValue (com.aerospike.client.Value.HLLValue)1 StringValue (com.aerospike.client.Value.StringValue)1 BatchListListener (com.aerospike.client.listener.BatchListListener)1