UpdateMap Class
Command used to update a Map in Riak.
As a convenience, a builder method is provided as well as an object with a fluent API for constructing the update.
var mapOp = new UpdateMap.MapOperation();
mapOp.incrementCounter('counter_1', 50)
.addToSet('set_1', 'set_value_1')
.setRegister('register_1', new Buffer('register_value_1'))
.setFlag('flag_1', true)
.map('inner_map')
.incrementCounter('counter_1', 50)
.addToSet('set_2', 'set_value_2');
var update = new UpdateMap.Builder()
.withBucketType('maps')
.withBucket('myBucket')
.withKey('map_1')
.withMapOperation(mapOp)
.withCallback(myCallback)
.withReturnBody(true)
.build();
Constructor
UpdateMap
-
options -
callback
Parameters:
-
optionsObjectThe options to use for this command.
-
bucketTypeStringThe bucket type in riak.
-
bucketStringThe bucket in riak.
-
opMapOperationThe set of modifications to make to this map.
-
[key]String optionalThe key for the counter you want to store. If not supplied Riak will gererate one.
-
[context]Buffer optionalThe context from a previous fetch. Required for remove operations.
-
[w]Number optionalThe W value to use.
-
[dw]Number optionalThe DW value to use.
-
[pw]Number optionalThe PW value to use.
-
[returnBody=true]Boolean optionalReturn the map.
-
[setsAsBuffers=false]Boolean optionalReturn sets as arrays of Buffers rather than strings.
-
[timeout]Number optionalSet a timeout for this command.
-
-
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.
-
-
dataObjectadditional error data. Will be null if no error.
-
Item Index
Methods
constructPbRequest
()
Object
protected
Returns:
getCallback
()
Function
private
Returns:
getExpectedResponseCode
()
Number
private
Returns:
getPbReqBuilder
()
Object
private
Returns:
getRiakMessage
()
Object
private
Returns:
onError
-
msg -
data
Parameters:
-
msgStringan error message -
dataObjectadditional error data
onRiakError
-
rpbErrorResp
Parameters:
-
rpbErrorRespObjectthe RpbErrorResp protocol buffer
onSuccess
-
pbResponseMessage
Parameters:
-
pbResponseMessageObjectthe protocol buffer received from riak
