Package com.basho.riak.client.core.query.crdt.ops

Examples of com.basho.riak.client.core.query.crdt.ops.CounterOp


    }

    @Override
    public CounterOp getOp()
    {
        return new CounterOp(delta);
    }
View Full Code Here


    @Test
    public void testGetCounterOp()
    {

        final long counterValue = 1;
        CounterOp op = new CounterOp(counterValue);
        DtUpdateOperation.Builder operation = new DtUpdateOperation.Builder(namespace);
        RiakDtPB.CounterOp counterOp = operation.getCounterOp(op);

        assertEquals(counterValue, counterOp.getIncrement());
View Full Code Here

        BinaryValue registerValue = BinaryValue.create("value");

        BinaryValue mapAddValue = BinaryValue.create("value");

        MapOp op = new MapOp()
            .update(counterKey, new CounterOp(1))
            .update(setKey, new SetOp().add(setAddValue))
            .update(flagKey, new FlagOp(true))
            .update(registerKey, new RegisterOp(registerValue))
            .update(mapKey, new MapOp());
View Full Code Here

    @Test
    public void testGetMapOpUpdateNestedMaps()
    {

        BinaryValue key1 = BinaryValue.create("key1");
        MapOp op1 = new MapOp().update(key1, new CounterOp(1));

        BinaryValue key2 = BinaryValue.create("key2");
        MapOp op2 = new MapOp().update(key2, op1);

        BinaryValue key3 = BinaryValue.create("key3");
View Full Code Here

        Location location = new Location(new Namespace(counterBucketType, bucketName), key);
        for (int i = 0; i < iterations; ++i)
        {
            DtUpdateOperation update =
                new DtUpdateOperation.Builder(location)
                    .withOp(new CounterOp(1))
                    .build();

            cluster.execute(update);
            update.get();
        }

        counter = fetchCounter(counterBucketType, bucketName, key);
        assertEquals((Long) iterations, counter.view());

        for (int i = 0; i < iterations; ++i)
        {
            DtUpdateOperation update =
                new DtUpdateOperation.Builder(location)
                    .withOp(new CounterOp(-1))
                    .build();

            cluster.execute(update);
            update.get();
        }
View Full Code Here


        mapKey = BinaryValue.create("counter");
       
        update = new DtUpdateOperation.Builder(location)
            .withOp(new MapOp().update(mapKey, new CounterOp(1)))
            .build();

        cluster.execute(update);
        update.get();
View Full Code Here

        MapOp innerMap = new MapOp();
       
        ByteBuffer nowBinary = ByteBuffer.allocate(8).putLong(System.currentTimeMillis());
        byte[] now = nowBinary.array();
       
        CounterOp counterOp = new CounterOp(1);
        RegisterOp registerOp = new RegisterOp(BinaryValue.create(now));
        FlagOp flagOp = new FlagOp(false);
        SetOp setOp = new SetOp()
                        .add(BinaryValue.create("Item 1"))
                        .add(BinaryValue.create("Item 2"));
View Full Code Here

     * @return the update used by the client core.
     */
    @Override
    public CounterOp getOp()
    {
        return new CounterOp(delta);
    }
View Full Code Here

TOP

Related Classes of com.basho.riak.client.core.query.crdt.ops.CounterOp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.