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:
-
bucket
Stringthe bucket in Riak
withBucketType
-
bucketType
Set the bucket type.
Parameters:
-
bucketType
Stringthe bucket type in riak
withCallback
-
callback
Set the callback to be executed when the operation completes.
Parameters:
-
callback
FunctionThe callback to be executed when the operation completes.
-
err
StringAn error message. Will be null if no error.
-
response
ObjectThe response from Riak. Will be null if returnBody is not set.
-
generatedKey
StringIf no key was supplied, Riak will generate and return one here. -
context
BufferAn opaque context to be used in any subsequent modification of the map. -
map
ObjectThe 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:
-
context
Bufferthe 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:
-
dw
Numberthe DW value.
withKey
-
key
Set the key. If not set, riak will generate and return a key.
Parameters:
-
key
Stringthe key in riak.
withMapOperation
-
mapOp
Set the modifications to make to this map.
Parameters:
-
mapOp
MapOperationthe 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:
-
pw
Numberthe PW value.
withReturnBody
-
returnBody
Return the counter after updating.
Parameters:
-
returnBody
Booleantrue 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:
-
setsAsBuffers
Booleantrue to not convert set contents to strings.
withTimeout
-
timeout
Set a timeout for this operation.
Parameters:
-
timeout
Numbera 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:
-
w
Numberthe W value.