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

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


    }

    @Override
    public FlagOp getOp()
    {
        return new FlagOp(flag);
    }
View Full Code Here


    public void testGetFlagOp()
    {

        final boolean enabled = true;

        FlagOp op = new FlagOp(enabled);

        DtUpdateOperation.Builder operation = new DtUpdateOperation.Builder(namespace);
        RiakDtPB.MapUpdate.FlagOp flagOp = operation.getFlagOp(op);

        assertEquals(RiakDtPB.MapUpdate.FlagOp.ENABLE, flagOp);
View Full Code Here

        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());

        DtUpdateOperation.Builder operation = new DtUpdateOperation.Builder(namespace);
        RiakDtPB.MapOp mapOp = operation.getMapOp(op);
View Full Code Here

        mapKey = BinaryValue.create("flag");

        update =
            new DtUpdateOperation.Builder(location)
                .withOp(new MapOp().update(mapKey, new FlagOp(true)))
                .build();

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

        map = fetchMap(mapBucketType, bucketName, key);
        assertEquals(3, map.view().size());
      assertNotNull(map.view().get(mapKey));
      assertEquals(1, map.view().get(mapKey).size());
        assertTrue(map.view().get(mapKey).get(0).isFlag());
        RiakFlag flag = map.view().get(mapKey).get(0).getAsFlag();
        assertTrue(flag.getEnabled());


        mapKey = BinaryValue.create("register");
       
        update = new DtUpdateOperation.Builder(location)
            .withOp(new MapOp().update(mapKey, new RegisterOp(mapKey)))
            .build();

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

        map = fetchMap(mapBucketType, bucketName, key);
        assertEquals(4, map.view().size());
      assertNotNull(map.view().get(mapKey));
      assertEquals(1, map.view().get(mapKey).size());
        RiakRegister register = map.view().get(mapKey).get(0).getAsRegister();
        assertEquals(mapKey, register.getValue());


        mapKey = BinaryValue.create("map");

        update = new DtUpdateOperation.Builder(location)
            .withOp(new MapOp().update(mapKey, new MapOp().update(mapKey, new FlagOp(false))))
            .build();

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

        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"));
       
        innerMap.update(logins, counterOp)
View Full Code Here

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

TOP

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

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.