API Docs for: 2.2.2
Show:

UpdateMap.Builder Class

A builder for constructing UpdateMap instances.

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

var update = new UpdateMap.Builder()
          .withBucketType('counters')
          .withBucket('myBucket')
          .withKey('counter_1')
          .withMapOperation(mapOp)
          .withCallback(callback)
          .build();

See UpdateMap.MapOperation

Constructor

UpdateMap.Builder

()

Methods

build

() UpdateMap

Construct an UpdateMap instance.

Returns:

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
)
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 be 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 map.
      • map Object
        The map in Riak, converted to a JS object.

withContext

(
  • context
)
chainable

The context returned from a previous fetch of this map. Note: this is required when performing any removes.

Parameters:

  • context Buffer

    the contect from a previous fetch.

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.

withKey

(
  • key
)
chainable

Set the key. If not set, riak will generate and return a key.

Parameters:

  • key String

    the key in riak.

withMapOperation

(
  • mapOp
)
chainable

Set the modifications to make to this map.

Parameters:

  • mapOp MapOperation

    the modifications

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.

withReturnBody

(
  • returnBody
)
chainable

Return the counter after updating.

Parameters:

  • returnBody Boolean

    true to return the counter.

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. Note this is only used with the returnBody option.

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. 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.