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();
Constructor
UpdateMap.Builder
()
Item Index
Methods
withBucket
-
bucket
Set the bucket.
Parameters:
-
bucketStringthe bucket in Riak
withBucketType
-
bucketType
Set the bucket type.
Parameters:
-
bucketTypeStringthe bucket type in riak
withCallback
-
callback
Set the callback to be executed when the operation completes.
Parameters:
-
callbackFunctionThe callback to be executed when the operation completes.
-
errStringAn error message. Will be null if no error.
-
responseObjectThe response from Riak. Will be null if returnBody is not set.
-
generatedKeyStringIf no key was supplied, Riak will generate and return one here. -
contextBufferAn opaque context to be used in any subsequent modification of the map. -
mapObjectThe map in Riak, converted to a JS object.
-
-
withContext
-
context
The context returned from a previous fetch of this map. Note: this is required when performing any removes.
Parameters:
-
contextBufferthe contect from a previous fetch.
withDw
-
dw
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:
-
dwNumberthe DW value.
withKey
-
key
Set the key. If not set, riak will generate and return a key.
Parameters:
-
keyStringthe key in riak.
withMapOperation
-
mapOp
Set the modifications to make to this map.
Parameters:
-
mapOpMapOperationthe modifications
withPw
-
pw
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:
-
pwNumberthe PW value.
withReturnBody
-
returnBody
Return the counter after updating.
Parameters:
-
returnBodyBooleantrue to return the counter.
withSetsAsBuffers
-
setsAsBuffers
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:
-
setsAsBuffersBooleantrue to not convert set contents to strings.
withTimeout
-
timeout
Set a timeout for this operation.
Parameters:
-
timeoutNumbera timeout in milliseconds.
withW
-
w
Set the W value. How many replicas to write to before returning a successful response. If not set the bucket default is used.
Parameters:
-
wNumberthe W value.
