Client Class
A Class that represents a Riak client.
The client constructor accepts a RiakCluster, or a list of host[:port] from which it will create a RiakCluster using our default configuration.
var Riak = require('basho-riak-client');
var client = new Riak.Client(['192.168.1.1:8087', '192.168.1.2:8087']);
Two styles of use are supported. Each command you can send to Riak is a class and can be instantiated then executed by the client's execute() method. In addition, convenience methods are provided directly by the Client class that corrispond to each of the commands.
// Using the builder, but options can also be passed directly to the constructor
var fetch = new KV.FetchValue.Builder()
.withBucket('myBucket')
.withKey('myKey')
.withCallback(callback)
.build();
client.execute(fetch);
or
client.fetchValue({ bucket: 'myBucket', key: 'myKey' }, callback);
All command callbacks are the typical node.js function(err, resp) style.
Constructor
Client
-
cluster
-
[callback]
Parameters:
-
cluster
String | RiakCluster- either an array of host[:port] strings or the cluster to use. See RiakCluster.
-
[callback]
Function optional- called when cluster is started (optional)
-
[err]
Object optional- set to an error if one occurrs during start.
-
[client]
Object optional- the client object.
-
[cluster]
Object optional- the cluster object.
Item Index
Methods
- deleteIndex
- deleteValue
- execute
- fetchBucketProps
- fetchBucketTypeProps
- fetchCounter
- fetchIndex
- fetchMap
- fetchPreflist
- fetchSchema
- fetchSet
- fetchValue
- getRiakCluster
- ListBuckets
- listKeys
- mapReduce
- ping
- resetBucketProps
- search
- secondaryIndexQuery
- shutdown
- stop
- storeBucketProps
- storeBucketTypeProps
- storeIndex
- storeSchema
- storeValue
- tsDelete
- tsDescribe
- tsGet
- tsListKeys
- tsQuery
- tsStore
- updateCounter
- updateMap
- updateSet
Methods
deleteIndex
-
options
-
callback
See DeleteIndex
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
deleteValue
-
options
-
callback
See DeleteValue
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
execute
-
command
Parameters:
-
command
ObjectAny Riak command object from the various modules.
fetchBucketProps
-
options
-
callback
See FetchBucketProps
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
fetchBucketTypeProps
-
options
-
callback
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
fetchCounter
-
options
-
callback
See FetchCounter
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
fetchIndex
-
options
-
callback
See FetchIndex
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
fetchMap
-
options
-
callback
See FetchMap
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
fetchPreflist
-
options
-
callback
See FetchPreflist
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
fetchSchema
-
options
-
callback
See FetchSchema
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
fetchSet
-
options
-
callback
See FetchSet
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
fetchValue
-
options
-
callback
See FetchValue
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
getRiakCluster
()
Core.RiakCluster
Get the client's RiakCluster.
Returns:
ListBuckets
-
options
-
callback
See ListBuckets
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
listKeys
-
options
-
callback
See ListKeys
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
mapReduce
-
query
-
callback
-
[stream=true]
See MapReduce
Parameters:
-
query
StringThe map-reduce query.
-
callback
FunctionThe callback to be executed when the operation completes.
-
[stream=true]
Boolean optionalStream the results or accumulate before calling callback.
ping
-
callback
See Ping
Parameters:
-
callback
FunctionThe callback to be executed when the operation completes.
resetBucketProps
-
options
-
callback
See ResetBucketProps
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
search
-
options
-
callback
See Search
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
secondaryIndexQuery
-
options
-
callback
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
shutdown
-
callback
Shut down the client gracefully.
This will cause all connections to be closed and any remaining in-flight commands to finish.
The provided callback will be added as a stateChange listener to the client's RiakCluster.
Parameters:
-
callback
Function- will be registered as a stateChange listener on the RiakCluster.
stop
-
callback
Stop the client gracefully.
This will cause all connections to be closed and any remaining in-flight commands to finish.
The provided callback will be called when the client is completely stopped.
Parameters:
-
callback
Function- will be called when client is stopped.
-
[err]
Object optional- set to an error if one occurrs during stop.
-
[state]
Object optional- the state of the cluster at shutdown.
storeBucketProps
-
options
-
callback
See StoreBucketProps
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
storeBucketTypeProps
-
options
-
callback
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
storeIndex
-
options
-
callback
See StoreIndex
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
storeSchema
-
options
-
callback
See StoreSchema
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
storeValue
-
options
-
callback
See StoreValue
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
tsDelete
-
options
-
callback
See Delete
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
tsDescribe
-
options
-
callback
See Describe
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
tsGet
-
options
-
callback
See Get
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
tsListKeys
-
options
-
callback
See ListKeys
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
tsQuery
-
options
-
callback
See Query
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
tsStore
-
options
-
callback
See Store
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
updateCounter
-
options
-
callback
See UpdateCounter
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
updateMap
-
options
-
callback
See UpdateMap
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.
updateSet
-
options
-
callback
See UpdateSet
Parameters:
-
options
ObjectThe options for this operation.
-
callback
FunctionThe callback to be executed when the operation completes.