API Docs for: 2.2.2
Show:

StorePropsBase Class

Constructor

StorePropsBase

(
  • options
  • pbRequestName
  • pbResponseName
  • callback
  • callback
)

Parameters:

  • options Object

    The properties to store

    • [r] Number optional

      The R value.

    • [pr] Number optional

      The PR value.

    • [w] Number optional

      The W value.

    • [dw] Number optional

      The DW value.

    • [pw] Number optional

      The PW value.

    • [rw] Number optional

      The RW value.

    • [notFoundOk] Boolean optional

      If true a vnode returning notfound for a key increments the r tally.

    • [basicQuorum] Boolean optional

      Controls whether a read request should return early in some fail cases.

    • [nVal] Number optional

      The number of replicas.

    • [allowMult] Boolean optional

      Whether to allow sibling objects to be created.

    • [lastWriteWins] Boolean optional

      Whether to ignore vector clocks when writing.

    • [oldVClock] Number optional

      An epoch time value.

    • [youngVClock] Number optional

      An epoch time value.

    • [bigVClock] Number optional

      An epoch time value.

    • [smallVClock] Number optional

      An epoch time value.

    • [backend] Sring optional

      The name of the backend to use.

    • [search] Boolean optional

      Enable the pre-commit hook for Legacy Riak search.

    • [searchIndex] String optional

      The name of the search index to use.

    • [chashKeyfun] Object optional

      An object representing the Erlang func to use.

    • [precommit] Object optional

      Array of precommit hooks

    • [postcommit] Object optional

      Array of postcommit hooks

  • pbRequestName String

    name of the Riak protocol buffer this command will send

  • pbResponseName String

    name of the Riak protocol buffer this command will receive

  • callback Function

    The callback to be executed when the operation completes.

    • err String

      An error message. Will be null if no error.

    • response Boolean

      the response from Riak. This will be true.

  • callback Function

    The callback to be executed when the operation completes.

    • String

      An error message. Will ne null if no error.

    • Object

      The response from Riak. This is an oject with all the bucket properties.

    • Object

      additional error data. Will be null if no error.

Methods

addPostcommitHook

(
  • postcommitHook
)
chainable

Add a pre-commit hook.

Parameters:

  • postcommitHook Object

    the hook to add.

addPrecommitHook

(
  • precommitHook
)
chainable

Add a pre-commit hook.

Parameters:

  • precommitHook Object

    the hook to add.

constructPbRequest

() Object protected
Construct and return the Riak protocol buffer message for this command. Subclasses must override this method.

Returns:

Object: a protocol buffer message builder

getCallback

() Function private
Fires the user's callback with the arguments passed in.

Returns:

Function: the user supplied callback

getExpectedResponseCode

() Number private
Returns the expected response code for this command.

Returns:

Number: the expected response code for this command.

getPbReqBuilder

() Object private
Returns and instance of the protocol buffer message builder for this command. This is determined via the pbRequestName passed to the constructor.

Returns:

Object: the builder for the protocol buffer message to be sent for this command

getRiakMessage

() Object private
Returns the encoded protobuf and message header.

Returns:

Object: object containing the header and encoded protobuf

onError

(
  • msg
  • data
)
protected
Called by RiakNode if an error occurs executing the command and all retries are exhausted.

Parameters:

  • msg String
    an error message
  • data Object
    additional error data

onRiakError

(
  • rpbErrorResp
)
protected
Called by RiakNode when a RpbErrorResp is received and all retries are exhausted. Commands may override this method.

Parameters:

  • rpbErrorResp Object
    the RpbErrorResp protocol buffer

onSuccess

(
  • pbResponseMessage
)
Boolean protected
Called by RiakNode when a response is received. Subclasses must override this method.

Parameters:

  • pbResponseMessage Object
    the protocol buffer received from riak

Returns:

Boolean: true if not streaming or the last response has been received, false otherwise.

withAllowMult

(
  • allowMult
)
chainable

Set the allow_multi value.

Parameters:

  • allowMult Boolean

    whether to allow sibling objects to be created.

withBackend

(
  • backend
)
chainable

Set the backend used by this bucket. Only applies when using riak_kv_multi_backend in Riak.

Parameters:

  • backend Sring

    the name of the backend to use.

withBasicQuorum

(
  • useBasicQuorum
)
chainable

Set the basic_quorum value. The parameter controls whether a read request should return early in some fail cases. E.g. If a quorum of nodes has already returned notfound/error, don't wait around for the rest.

Parameters:

  • useBasicQuorum Boolean

    the basic_quorum value.

withBigVClock

(
  • bigVClock
)
chainable

Set the big VClock value.

Parameters:

  • bigVClock Number

    an epoch time value

withBucketType

(
  • bucketType
)
chainable

Set the bucket type. If not supplied, 'default' is used.

Parameters:

  • bucketType String

    the bucket type in riak

withCallback

(
  • callback
)
chainable

Set the callback to be executed when the operation completes.

Parameters:

  • callback Function

    The callback to be executed when the operation completes.

    • err String

      An error message. Will ne null if no error.

    • response Object

      The response from Riak. This is an oject with all the bucket properties.

withChashkeyFunction

(
  • func
)
chainable

Set the chash_keyfun value.

Parameters:

  • func Object

    a object representing the Erlang func to use.

withDw

(
  • dw
)
chainable

Set the DW value. How many replicas to commit to durable storage before returning a successful response. If not set the bucket default is used.

Parameters:

  • dw Number

    the DW value.

withLastWriteWins

(
  • lastWriteWins
)
chainable

Set the last_write_wins value. Unless you really know what you're doing, you probably do not want to set this to true.

Parameters:

  • lastWriteWins Boolean

    whether to ignore vector clocks when writing.

withLegacySearchEnabled

(
  • search
)
chainable

Enable Legacy Riak Search. Setting this to true causes the search pre-commit hook to be added.

Note this is only for legacy Riak (< v2.0) Search support.

Parameters:

  • search Boolean

    enable add/remove (true/false) the pre-commit hook for Legacy Riak Search.

withNotFoundOk

(
  • notFoundOk
)
chainable

Set the not_found_ok value. If true a vnode returning notfound for a key increments the r tally. False is higher consistency, true is higher availability.

Parameters:

  • notFoundOk Boolean

    the not_found_ok value.

withNVal

(
  • nVal
)
chainable

Set the nVal.

Parameters:

  • nVal Number

    the number of replicas.

withOldVClock

(
  • oldVClock
)
chainable

Set the old VClock value

Parameters:

  • oldVClock Number

    an epoch time value

withPr

(
  • pr
)
chainable

Set the PR value. If not asSet the bucket default is used.

Parameters:

  • pr Number

    the PR value.

withPw

(
  • pw
)
chainable

Set the PW value. How many primary nodes must be up when the write is attempted. If not set the bucket default is used.

Parameters:

  • pw Number

    the PW value.

withR

(
  • r
)
chainable

Set the R value. If not asSet the bucket default is used.

Parameters:

  • r Number

    the R value.

withRw

(
  • rw
)
chainable

Set the RW value. Quorum for both operations (get and put) involved in deleting an object .

Parameters:

  • rw Number

    the RW value.

withSearchIndex

(
  • searchIndex
)
chainable

Associate a Search Index. This only applies if Yokozuna is enabled in Riak v2.0.

Parameters:

  • searchIndex String

    The name of the search index to use.

withSmallVClock

(
  • smallVClock
)
chainable

Set the small VClock value.

Parameters:

  • smallVClock Number

    an epoch time value.

withW

(
  • w
)
chainable

Set the W value. How many replicas to write to before returning a successful response. If not set the bucket default is used.

Parameters:

  • w Number

    the W value.

withYoungVClock

(
  • youngVClock
)
chainable

Set the young VClock value

Parameters:

  • youngVClock Number

    an epoch time value