API Docs for: 2.2.2
Show:

Client Class

Defined in: lib/client.js:31
Module: Client

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]
)

Defined in lib/client.js:31

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.

Methods

deleteIndex

(
  • options
  • callback
)

Defined in lib/client.js:373

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

deleteValue

(
  • options
  • callback
)

Defined in lib/client.js:167

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

execute

(
  • command
)

Defined in lib/client.js:148

Parameters:

  • command Object

    Any Riak command object from the various modules.

fetchBucketProps

(
  • options
  • callback
)

Defined in lib/client.js:178

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

fetchBucketTypeProps

(
  • options
  • callback
)

Defined in lib/client.js:189

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

fetchCounter

(
  • options
  • callback
)

Defined in lib/client.js:303

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

fetchIndex

(
  • options
  • callback
)

Defined in lib/client.js:384

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

fetchMap

(
  • options
  • callback
)

Defined in lib/client.js:347

See FetchMap

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

fetchPreflist

(
  • options
  • callback
)

Defined in lib/client.js:211

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

fetchSchema

(
  • options
  • callback
)

Defined in lib/client.js:395

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

fetchSet

(
  • options
  • callback
)

Defined in lib/client.js:325

See FetchSet

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

fetchValue

(
  • options
  • callback
)

Defined in lib/client.js:200

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

getRiakCluster

() Core.RiakCluster

Defined in lib/client.js:134

Get the client's RiakCluster.

Returns:

Core.RiakCluster:

ListBuckets

(
  • options
  • callback
)

Defined in lib/client.js:222

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

listKeys

(
  • options
  • callback
)

Defined in lib/client.js:233

See ListKeys

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

mapReduce

(
  • query
  • callback
  • [stream=true]
)

Defined in lib/client.js:443

See MapReduce

Parameters:

  • query String

    The map-reduce query.

  • callback Function

    The callback to be executed when the operation completes.

  • [stream=true] Boolean optional

    Stream the results or accumulate before calling callback.

ping

(
  • callback
)

Defined in lib/client.js:157

See Ping

Parameters:

  • callback Function

    The callback to be executed when the operation completes.

resetBucketProps

(
  • options
  • callback
)

Defined in lib/client.js:266

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

secondaryIndexQuery

(
  • options
  • callback
)

Defined in lib/client.js:244

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

shutdown

(
  • callback
)

Defined in lib/client.js:96

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.

See: RiakCluster.stateChange

Parameters:

  • callback Function
    • will be registered as a stateChange listener on the RiakCluster.

stop

(
  • callback
)

Defined in lib/client.js:116

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
)

Defined in lib/client.js:255

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

storeBucketTypeProps

(
  • options
  • callback
)

Defined in lib/client.js:277

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

storeIndex

(
  • options
  • callback
)

Defined in lib/client.js:417

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

storeSchema

(
  • options
  • callback
)

Defined in lib/client.js:428

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

storeValue

(
  • options
  • callback
)

Defined in lib/client.js:288

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

tsDelete

(
  • options
  • callback
)

Defined in lib/client.js:508

See Delete

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

tsDescribe

(
  • options
  • callback
)

Defined in lib/client.js:472

See Describe

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

tsGet

(
  • options
  • callback
)

Defined in lib/client.js:496

See Get

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

tsListKeys

(
  • options
  • callback
)

Defined in lib/client.js:520

See ListKeys

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

tsQuery

(
  • options
  • callback
)

Defined in lib/client.js:484

See Query

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

tsStore

(
  • options
  • callback
)

Defined in lib/client.js:460

See Store

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

updateCounter

(
  • options
  • callback
)

Defined in lib/client.js:314

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

updateMap

(
  • options
  • callback
)

Defined in lib/client.js:358

See UpdateMap

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.

updateSet

(
  • options
  • callback
)

Defined in lib/client.js:336

See UpdateSet

Parameters:

  • options Object

    The options for this operation.

  • callback Function

    The callback to be executed when the operation completes.