Package com.basho.riak.client.api.commands.datatypes

Examples of com.basho.riak.client.api.commands.datatypes.MapUpdate


      favorites.add(BinaryValue.create(buffer.array()));
      buffer.rewind();
    }

    // Create an update for the user's values
    MapUpdate userMapUpdate = new MapUpdate()
      .update(numLogins, new CounterUpdate(1))                // counter
      .update(lastLoginTime, new RegisterUpdate(now))     // register
      .update(loggedIn, new FlagUpdate(true))                   // flag
      .update(shoppingCart, favorites);              // asSet

    // Now create an update for the user's entry
    MapUpdate userEntryUpdate = new MapUpdate()
      .update(username, userMapUpdate);

    UpdateMap update = new UpdateMap.Builder(carts, userEntryUpdate)
      .withOption(Option.RETURN_BODY, true)
      .build();
View Full Code Here


  public void testConflict() throws ExecutionException, InterruptedException
  {

    resetAndEmptyBucket(carts);

        MapUpdate innerMapUpdate = new MapUpdate().update("flag", new FlagUpdate(true));
        CounterUpdate innerCounterUpdate = new CounterUpdate(1);
       
    // Insert a Map and Counter into logins and observe both counter and map returned
    UpdateMap conflictedUpdateCmd =
      new UpdateMap.Builder(carts, new MapUpdate().update(numLogins, innerMapUpdate).update(numLogins, innerCounterUpdate))
        .withOption(Option.RETURN_BODY, true)
        .build();

    UpdateMap.Response conflictedResponse =
      client.execute(conflictedUpdateCmd);
View Full Code Here

    @Test
    public void testStore() throws ExecutionException, InterruptedException
    {

        MapUpdate update = new MapUpdate();

        UpdateMap store = new UpdateMap.Builder(key, update)
          .withContext(context)
            .withOption(Option.DW, new Quorum(1))
            .withOption(Option.PW, new Quorum(1))
View Full Code Here

            favorites.add(BinaryValue.create(buffer.array()));
            buffer.rewind();
        }

        // Create an update for the user's values
        MapUpdate userMapUpdate = new MapUpdate()
            .update(numLogins, new CounterUpdate(1))                // counter
            .update(lastLoginTime, new RegisterUpdate(now))     // register
            .update(loggedIn, new FlagUpdate(true))                   // flag
            .update(shoppingCart, favorites);              // asSet

        // Now create an update for the user's entry
        MapUpdate userEntryUpdate = new MapUpdate()
            .update(username, userMapUpdate);

        Location location = new Location(new Namespace(mapBucketType, bucketName), key);
        DtUpdateOperation update =
            new DtUpdateOperation.Builder(location)
                .withOp(userEntryUpdate.getOp())
                .build();

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

TOP

Related Classes of com.basho.riak.client.api.commands.datatypes.MapUpdate

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.