|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.basho.riak.client.DefaultRiakClient
public final class DefaultRiakClient
The default implementation of IRiakClient. Provides convenient, transport agnostic ways to perform bucket and query operations on Riak.
This class is a wrapper around a RawClient of your choice. The RawClient wrapped is passed to all
RiakOperations created by this class, so it really needs to be Thread Safe and reusable.
This class provides a Retrier to each RiakOperation it creates. If you provide one please make sure it is
Thread safe and reusable.
If you do not provide a Retrier a DefaultRetrier configured for 3 attempts is created.
RawClient,
PBClientAdapter,
HTTPClientAdapter,
DefaultRetrier| Method Summary | |
|---|---|
WriteBucket |
createBucket(String bucketName)
Create a new WriteBucket operation
to create a Bucket named for the passed String. |
FetchBucket |
fetchBucket(String bucketName)
Create a new FetchBucket operation, and return it. |
byte[] |
generateAndSetClientId()
Generate, set and return "random" byte[4] id for the client. |
byte[] |
getClientId()
Retrieve the client id from Riak that this client is using. |
Transport |
getTransport()
Optional method, the underlying transport. |
Set<String> |
listBuckets()
Set view of buckets in Riak |
BucketKeyMapReduce |
mapReduce()
Create MapReduce operation for a set of
bucket/key inputs. |
IndexMapReduce |
mapReduce(IndexQuery query)
Create a MapReduce operation that uses the supplied
IndexQuery as input |
BucketMapReduce |
mapReduce(String bucket)
Create MapReduce operation that has the supplied bucket as its input. |
SearchMapReduce |
mapReduce(String bucket,
String query)
Create a MapReduce operation that uses the supplied Riak Search
query as input. |
void |
ping()
Ping Riak, check it is available |
IRiakClient |
setClientId(byte[] clientId)
Set an ID for this client. |
void |
shutdown()
|
Iterable<NodeStats> |
stats()
Perform the Riak /stats operation on the node(s) this client
is connected to. |
WriteBucket |
updateBucket(Bucket b)
Create a new WriteBucket operation to update passed bucket. |
LinkWalk |
walk(IRiakObject startObject)
Create a LinkWalk operation that starts at startObject. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public Set<String> listBuckets()
throws RiakException
IRiakClient
listBuckets in interface IRiakClientRiakExceptionpublic WriteBucket updateBucket(Bucket b)
IRiakClientWriteBucket operation to update passed bucket.
updateBucket in interface IRiakClientb - the name of the Bucket.
WriteBucket configured to update the supplied bucket
for further configuration and execution.WriteBucketpublic FetchBucket fetchBucket(String bucketName)
IRiakClientFetchBucket operation, and return it.
fetchBucket in interface IRiakClientFetchBucket configured to return the Bucket called bucketName
for further configuration and execution.FetchBucketpublic WriteBucket createBucket(String bucketName)
IRiakClientWriteBucket operation
to create a Bucket named for the passed String.
createBucket in interface IRiakClientbucketName - the name of the new bucket.
WriteBucket configured to create the new bucket
for further configuration and execution.WriteBucket
public IRiakClient setClientId(byte[] clientId)
throws RiakException
IRiakClient
setClientId in interface IRiakClientclientId - byte[4] that uniquely identify the client
RiakException - if operation fails
public byte[] generateAndSetClientId()
throws RiakException
IRiakClient
generateAndSetClientId in interface IRiakClientRiakExceptionClientId
public byte[] getClientId()
throws RiakException
IRiakClient
getClientId in interface IRiakClientRiakExceptionpublic BucketKeyMapReduce mapReduce()
IRiakClientMapReduce operation for a set of
bucket/key inputs.
See also Map Reduce on the basho site.
mapReduce in interface IRiakClientBucketKeyMapReduce for configuration and execution.MapReduce,
BucketKeyMapReducepublic BucketMapReduce mapReduce(String bucket)
IRiakClientMapReduce operation that has the supplied bucket as its input.
mapReduce in interface IRiakClientbucket - the String name of the input bucket to the M/R job.
BucketMapReduce for further configuration and execution.MapReduce,
BucketMapReduce
public SearchMapReduce mapReduce(String bucket,
String query)
IRiakClientMapReduce operation that uses the supplied Riak Search
query as input.
See also
Riak Search on the basho wiki for more information.
mapReduce in interface IRiakClientbucket - the input bucket for the search queryquery - the input query for the search
SearchMapReduce operation for further configuration and
execution.public IndexMapReduce mapReduce(IndexQuery query)
IRiakClientMapReduce operation that uses the supplied
IndexQuery as input
Note: if you just want to fetch an index see
Bucket.fetchIndex(com.basho.riak.client.query.indexes.RiakIndex)
to create a FetchIndex operation
mapReduce in interface IRiakClientquery - the IndexQuery to use as input
MapReduce operation for further configuration and
executionpublic LinkWalk walk(IRiakObject startObject)
IRiakClientLinkWalk operation that starts at startObject.
See also Link Walking on the basho site.
walk in interface IRiakClientstartObject - the IRiakObject to start the Link walk from.
LinkWalk operation for further configuration and execution.LinkWalk
public void ping()
throws RiakException
IRiakClient
ping in interface IRiakClientRiakException - if Riak does not respond OKpublic Transport getTransport()
IRiakClient
getTransport in interface IRiakClientTransport or null if not implemented.public void shutdown()
shutdown in interface IRiakClient
public Iterable<NodeStats> stats()
throws RiakException
IRiakClient/stats operation on the node(s) this client
is connected to.
This is not supported by the Riak Protobuf API
stats in interface IRiakClientIterable object that contains one or more NodeStats
RiakException - If Riak does not respond or if the protobuf API is being used
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||