API Docs for: 2.2.2
Show:

UpdateSet.Builder Class

A builder for constructing UpdateSet instances.

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

var update = new UpdateSet.Builder()
                  .withBucketType('myBucketType')
                  .withBucket('myBucket')
                  .withKey('myKey')
                  .withAdditions(['this', 'that', 'other'])
                  .withCallback(myCallback)
                  .build();

Constructor

UpdateSet.Builder

()

Methods

build

() UpdateSet

Construct an UpdateSet instance.

Returns:

withAdditions

(
  • additions
)
chainable

The values you wish to add to this set.

Parameters:

  • additions String | Buffer

    The values to add.

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.

Parameters:

  • bucketType String

    the bucket type in riak

withCallback

(
  • callback
)

Set the callback.

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. will be null if returnBody is not set.

      • generatedKey String
        If no key was supplied, Riak will generate and return one here.
      • context Buffer
        An opaque context to be used in any subsequent modification of the set.
      • values String | Buffer
        An array holding the values in the set. String by default, Buffers if setsAsBuffers was used.

withContext

(
  • context
)
chainable

Set the causal context. The context is necessary for set removals. It is an opaque field, and should not be parsed or modified.

Parameters:

  • context ByteBuffer

    the causal context

withDw

(
  • dw
)
chainable

Set the DW value. If not set the bucket default is used.

Parameters:

  • dw Number

    the DW value.

withKey

(
  • key
)
chainable

Set the key. If this is not set one will be generated by and returned from Riak

Parameters:

  • key String

    the key in riak.

withPw

(
  • pw
)
chainable

Set the PW value. If not set the bucket default is used.

Parameters:

  • pw Number

    the PW value.

withRemovals

(
  • removals
)
chainable

The values you wish to remove from this set. Note: when performing removals a context must be provided.

Parameters:

  • removals String | Buffer

    The values to remove.

withReturnBody

(
  • returnBody
)
chainable

Set the return_body value. If true, the callback is passed the contents of the set after the update.

Parameters:

  • returnBody Boolean

    the return_body value.

withSetsAsBuffers

(
  • setsAsBuffers
)
chainable

Return sets as arrays of Buffers rather than strings. By default the contents of sets are converted to strings. Setting this to true will cause this not to occur and the raw bytes returned as Buffer objects.

Parameters:

  • setsAsBuffers Boolean

    true to not convert set contents to strings.

withTimeout

(
  • timeout
)
chainable

Set a timeout for this operation.

Parameters:

  • timeout Number

    a timeout in milliseconds.

withW

(
  • w
)
chainable

Set the W value. If not set the bucket default is used.

Parameters:

  • w Number

    the W value.