API Docs for: 2.2.2
Show:

FetchValue.Builder Class

A builder for constructing FetchValue instances.

Rather than having to manually construct the options and instantiating a FetchValue directly, this builder may be used.

var fetchValue = new FetchValue.Builder()
     .withBucket('myBucket')
     .withKey('myKey')
     .build();

Constructor

FetchValue.Builder

()

Methods

build

() FetchValue

Construct a FetchValue command.

Returns:

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.

withBucket

(
  • bucket
)
chainable

Set the bucket.

Parameters:

  • bucket String

    the bucket in Riak

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.

      • isNotFound Boolean
        True if there was no value in Riak.
      • isUnchanged Boolean
        True if the object has not changed (based on a vclock provided via ifModified)
      • vclock Buffer
        The vector clock for this object (and its siblings)
      • values Object | RiakObject[]
        An array of one or more values. Either RiakObjects or JS objects if convertToJs was used.

withConflictResolver

(
  • conflictResolver
)
chainable

Provide a conflict resolver to resolve siblings. If siblings are present Riak will return all of them. The provided function will be used to resolve these to a single response.

If a conflict resolver is not provided all siblings will be returned.

Parameters:

  • conflictResolver Function
    • the conflict resolver to be used.

withConvertValueToJs

(
  • convert
)
chainable

Convert the value stored in Riak to a JS object. Values are stored in Riak as bytes. Setting this to true will convert the value to a JS object using JSON.parse() before passing them to the conflict resolver.

Parameters:

  • convert Boolean
    • true to convert the value(s), false otherwise.

withHeadOnly

(
  • headOnly
)
chainable

Return only the metadata. Causes Riak to only return the metadata for the object. The value will be asSet to null.

Parameters:

  • headOnly Boolean

    true to return only metadata.

withIfModified

(
  • vclock
)
chainable

Return the object if the supplied vclock does not match.

Parameters:

  • vclock Buffer

    the vclock to match on

withKey

(
  • key
)
chainable

Set the key.

Parameters:

  • key String

    the key in riak.

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. If not asSet the bucket default is used.

Parameters:

  • notFoundOk Boolean

    the not_found_ok value.

withPr

(
  • pr
)
chainable

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

Parameters:

  • pr Number

    the PR value.

withR

(
  • r
)
chainable

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

Parameters:

  • r Number

    the R value.

withReturnDeletedVClock

(
  • returnDeletedVClock
)
chainable

Set whether to return tombstones.

Parameters:

  • returnDeletedVClock Boolean

    true to return tombstones, false otherwise.

withTimeout

(
  • timeout
)
chainable

Set a timeout for this operation.

Parameters:

  • timeout Number

    a timeout in milliseconds.