com.basho.riak.pbc
Class RiakClient

java.lang.Object
  extended by com.basho.riak.pbc.RiakClient

public class RiakClient
extends Object

Low level protocol buffers client.


Field Summary
static int MSG_DelReq
           
static int MSG_DelResp
           
static int MSG_ErrorResp
           
static int MSG_GetBucketReq
           
static int MSG_GetBucketResp
           
static int MSG_GetClientIdReq
           
static int MSG_GetClientIdResp
           
static int MSG_GetReq
           
static int MSG_GetResp
           
static int MSG_GetServerInfoReq
           
static int MSG_GetServerInfoResp
           
static int MSG_ListBucketsReq
           
static int MSG_ListBucketsResp
           
static int MSG_ListKeysReq
           
static int MSG_ListKeysResp
           
static int MSG_MapRedReq
           
static int MSG_MapRedResp
           
static int MSG_PingReq
           
static int MSG_PingResp
           
static int MSG_PutReq
           
static int MSG_PutResp
           
static int MSG_SetBucketReq
           
static int MSG_SetBucketResp
           
static int MSG_SetClientIdReq
           
static int MSG_SetClientIdResp
           
 
Constructor Summary
RiakClient(InetAddress addr, int port)
           
RiakClient(RiakConnectionPool pool)
           
RiakClient(String host)
           
RiakClient(String host, int port)
           
RiakClient(String host, int port, int bufferSizeKb)
           
 
Method Summary
 void delete(com.google.protobuf.ByteString bucket, com.google.protobuf.ByteString key)
           
 void delete(com.google.protobuf.ByteString bucket, com.google.protobuf.ByteString key, DeleteMeta deleteMeta)
           
 void delete(com.google.protobuf.ByteString bucket, com.google.protobuf.ByteString key, int rw)
           
 void delete(String bucket, String key)
           
 void delete(String bucket, String key, DeleteMeta deleteMeta)
           
 void delete(String bucket, String key, int rw)
           
 RiakObject[] fetch(com.google.protobuf.ByteString bucket, com.google.protobuf.ByteString key)
           
 FetchResponse fetch(com.google.protobuf.ByteString bucket, com.google.protobuf.ByteString key, FetchMeta fetchMeta)
           
 RiakObject[] fetch(com.google.protobuf.ByteString bucket, com.google.protobuf.ByteString key, int readQuorum)
           
 RiakObject[] fetch(String bucket, String key)
           
 FetchResponse fetch(String bucket, String key, FetchMeta fetchMeta)
           
 RiakObject[] fetch(String bucket, String key, int readQuorum)
           
 BucketProperties getBucketProperties(com.google.protobuf.ByteString bucket)
           
 String getClientID()
           
 Map<String,String> getServerInfo()
           
 com.google.protobuf.ByteString[] listBuckets()
           
 KeySource listKeys(com.google.protobuf.ByteString bucket)
           
 MapReduceResponseSource mapReduce(com.google.protobuf.ByteString request, IRequestMeta meta)
           
 MapReduceResponseSource mapReduce(JSONObject obj)
           
 MapReduceResponseSource mapReduce(String request, IRequestMeta meta)
           
 void ping()
           
 void prepareClientID()
          helper method to use a reasonable default client id beware, it caches the client id.
 void setBucketProperties(com.google.protobuf.ByteString bucket, BucketProperties props)
           
 void setClientID(com.google.protobuf.ByteString id)
           
 void setClientID(String id)
          Warning: the riak client id is 4 bytes.
 void shutdown()
           
 void store(RiakObject value)
           
 com.google.protobuf.ByteString[] store(RiakObject[] values, RequestMeta meta)
           
 RiakObject[] store(RiakObject value, IRequestMeta meta)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_ErrorResp

public static final int MSG_ErrorResp
See Also:
Constant Field Values

MSG_PingReq

public static final int MSG_PingReq
See Also:
Constant Field Values

MSG_PingResp

public static final int MSG_PingResp
See Also:
Constant Field Values

MSG_GetClientIdReq

public static final int MSG_GetClientIdReq
See Also:
Constant Field Values

MSG_GetClientIdResp

public static final int MSG_GetClientIdResp
See Also:
Constant Field Values

MSG_SetClientIdReq

public static final int MSG_SetClientIdReq
See Also:
Constant Field Values

MSG_SetClientIdResp

public static final int MSG_SetClientIdResp
See Also:
Constant Field Values

MSG_GetServerInfoReq

public static final int MSG_GetServerInfoReq
See Also:
Constant Field Values

MSG_GetServerInfoResp

public static final int MSG_GetServerInfoResp
See Also:
Constant Field Values

MSG_GetReq

public static final int MSG_GetReq
See Also:
Constant Field Values

MSG_GetResp

public static final int MSG_GetResp
See Also:
Constant Field Values

MSG_PutReq

public static final int MSG_PutReq
See Also:
Constant Field Values

MSG_PutResp

public static final int MSG_PutResp
See Also:
Constant Field Values

MSG_DelReq

public static final int MSG_DelReq
See Also:
Constant Field Values

MSG_DelResp

public static final int MSG_DelResp
See Also:
Constant Field Values

MSG_ListBucketsReq

public static final int MSG_ListBucketsReq
See Also:
Constant Field Values

MSG_ListBucketsResp

public static final int MSG_ListBucketsResp
See Also:
Constant Field Values

MSG_ListKeysReq

public static final int MSG_ListKeysReq
See Also:
Constant Field Values

MSG_ListKeysResp

public static final int MSG_ListKeysResp
See Also:
Constant Field Values

MSG_GetBucketReq

public static final int MSG_GetBucketReq
See Also:
Constant Field Values

MSG_GetBucketResp

public static final int MSG_GetBucketResp
See Also:
Constant Field Values

MSG_SetBucketReq

public static final int MSG_SetBucketReq
See Also:
Constant Field Values

MSG_SetBucketResp

public static final int MSG_SetBucketResp
See Also:
Constant Field Values

MSG_MapRedReq

public static final int MSG_MapRedReq
See Also:
Constant Field Values

MSG_MapRedResp

public static final int MSG_MapRedResp
See Also:
Constant Field Values
Constructor Detail

RiakClient

public RiakClient(String host)
           throws IOException
Throws:
IOException

RiakClient

public RiakClient(String host,
                  int port)
           throws IOException
Throws:
IOException

RiakClient

public RiakClient(RiakConnectionPool pool)

RiakClient

public RiakClient(InetAddress addr,
                  int port)
           throws IOException
Throws:
IOException

RiakClient

public RiakClient(String host,
                  int port,
                  int bufferSizeKb)
           throws IOException
Throws:
IOException
Method Detail

prepareClientID

public void prepareClientID()
                     throws IOException
helper method to use a reasonable default client id beware, it caches the client id. If you call it multiple times on the same client you get the *same* id (not good for reusing a client with different ids)

Throws:
IOException

ping

public void ping()
          throws IOException
Throws:
IOException

setClientID

public void setClientID(String id)
                 throws IOException
Warning: the riak client id is 4 bytes. This method silently truncates anymore bytes than that. Be aware that if you have two client Ids, "boris1" and "boris2" this method will leave you with 1 client id, "bori". Use prepareClientID() to generate a reasonably unique Id.

Parameters:
id -
Throws:
IOException
See Also:
prepareClientID()

setClientID

public void setClientID(com.google.protobuf.ByteString id)
                 throws IOException
Throws:
IOException

getClientID

public String getClientID()
                   throws IOException
Throws:
IOException

getServerInfo

public Map<String,String> getServerInfo()
                                 throws IOException
Throws:
IOException

fetch

public RiakObject[] fetch(String bucket,
                          String key,
                          int readQuorum)
                   throws IOException
Throws:
IOException

fetch

public RiakObject[] fetch(com.google.protobuf.ByteString bucket,
                          com.google.protobuf.ByteString key,
                          int readQuorum)
                   throws IOException
Throws:
IOException

fetch

public FetchResponse fetch(String bucket,
                           String key,
                           FetchMeta fetchMeta)
                    throws IOException
Throws:
IOException

fetch

public FetchResponse fetch(com.google.protobuf.ByteString bucket,
                           com.google.protobuf.ByteString key,
                           FetchMeta fetchMeta)
                    throws IOException
Throws:
IOException

fetch

public RiakObject[] fetch(String bucket,
                          String key)
                   throws IOException
Throws:
IOException

fetch

public RiakObject[] fetch(com.google.protobuf.ByteString bucket,
                          com.google.protobuf.ByteString key)
                   throws IOException
Throws:
IOException

store

public com.google.protobuf.ByteString[] store(RiakObject[] values,
                                              RequestMeta meta)
                                       throws IOException
Throws:
IOException

store

public void store(RiakObject value)
           throws IOException
Throws:
IOException

store

public RiakObject[] store(RiakObject value,
                          IRequestMeta meta)
                   throws IOException
Throws:
IOException

delete

public void delete(String bucket,
                   String key,
                   DeleteMeta deleteMeta)
            throws IOException
Throws:
IOException

delete

public void delete(com.google.protobuf.ByteString bucket,
                   com.google.protobuf.ByteString key,
                   DeleteMeta deleteMeta)
            throws IOException
Throws:
IOException

delete

public void delete(String bucket,
                   String key,
                   int rw)
            throws IOException
Throws:
IOException

delete

public void delete(com.google.protobuf.ByteString bucket,
                   com.google.protobuf.ByteString key,
                   int rw)
            throws IOException
Throws:
IOException

delete

public void delete(String bucket,
                   String key)
            throws IOException
Throws:
IOException

delete

public void delete(com.google.protobuf.ByteString bucket,
                   com.google.protobuf.ByteString key)
            throws IOException
Throws:
IOException

listBuckets

public com.google.protobuf.ByteString[] listBuckets()
                                             throws IOException
Throws:
IOException

getBucketProperties

public BucketProperties getBucketProperties(com.google.protobuf.ByteString bucket)
                                     throws IOException
Throws:
IOException

setBucketProperties

public void setBucketProperties(com.google.protobuf.ByteString bucket,
                                BucketProperties props)
                         throws IOException
Throws:
IOException

listKeys

public KeySource listKeys(com.google.protobuf.ByteString bucket)
                   throws IOException
Throws:
IOException

mapReduce

public MapReduceResponseSource mapReduce(JSONObject obj)
                                  throws IOException
Throws:
IOException

mapReduce

public MapReduceResponseSource mapReduce(String request,
                                         IRequestMeta meta)
                                  throws IOException
Throws:
IOException

mapReduce

public MapReduceResponseSource mapReduce(com.google.protobuf.ByteString request,
                                         IRequestMeta meta)
                                  throws IOException
Throws:
IOException

shutdown

public void shutdown()


Copyright © 2012. All Rights Reserved.