com.basho.riak.client.api.commands.kv.FetchValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riak-client Show documentation
Show all versions of riak-client Show documentation
HttpClient-based client for Riak
/*
* Copyright 2013 Basho Technologies Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basho.riak.client.api.commands.kv;
import com.basho.riak.client.api.cap.Quorum;
import com.basho.riak.client.api.cap.VClock;
import com.basho.riak.client.core.RiakCluster;
import com.basho.riak.client.core.operations.FetchOperation;
import com.basho.riak.client.api.RiakCommand;
import com.basho.riak.client.core.RiakFuture;
import com.basho.riak.client.api.commands.CoreFutureAdapter;
import com.basho.riak.client.api.commands.RiakOption;
import com.basho.riak.client.core.query.Location;
import java.util.HashMap;
import java.util.Map;
/**
* Command used to fetch a value from Riak.
*
*
* Fetching an object from Riak is a simple matter of supplying a {@link com.basho.riak.client.core.query.Location}
* and executing the FetchValue operation.
*
* {@code
* Namespace ns = new Namespace("my_type","my_bucket");
* Location loc = new Location(ns, "my_key");
* FetchValue fv = new FetchValue.Builder(loc).build();
* FetchValue.Response response = client.execute(fv);
* RiakObject obj = response.getValue(RiakObject.class);}
*
*
* All operations can called async as well.
*
* {@code
* ...
* RiakFuture future = client.executeAsync(fv);
* ...
* future.await();
* if (future.isSuccess())
* {
* ...
* }}
*
*
* ORM features are also provided when retrieving the results from the response.
* By default, JSON serialization / deserializtion is used. For example, if
* the value stored in Riak was JSON and mapped to your class {@code MyPojo}:
*
* {@code
* ...
* MyPojo mp = response.getValue(MyPojo.class);
* ...}
*
*
* @author Dave Rusek
* @since 2.0
* @see Response
*/
public final class FetchValue extends RiakCommand
{
private final Location location;
private final Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy