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:
-
options
ObjectThe options to use for this command.
-
bucketType
StringThe bucket type in riak.
-
bucket
StringThe bucket in riak.
-
op
MapOperationThe 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.
-
-
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.
-
-
data
Objectadditional 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:
-
msg
Stringan error message -
data
Objectadditional error data
onRiakError
-
rpbErrorResp
Parameters:
-
rpbErrorResp
Objectthe RpbErrorResp protocol buffer
onSuccess
-
pbResponseMessage
Parameters:
-
pbResponseMessage
Objectthe protocol buffer received from riak