UpdateCounter.Builder Class
A builder for constructing UpdateCounter instances.
Rather than having to manually construct the options and instantiating a UpdateCounter directly, this builder may be used.
var update = new UpdateCounter.Builder()
.withBucketType('counters')
.withBucket('myBucket')
.withKey('counter_1')
.withIncrement(100)
.withCallback(callback)
.build();
Constructor
UpdateCounter.Builder
()
Item Index
Methods
build
()
UpdateCounter
Construct a UpdateCounter instance.
Returns:
a UpdateCounter instance
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 ne null if returnBody not set.
-
generatedKey
StringIf no key was supplied, Riak will generate and return one here. -
counterValue
NumberThe value of the counter in Riak.
-
-
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.
withIncrement
-
increment
Set the increment to apply to this counter. This may be negative as well as positive.
Parameters:
-
increment
Numberthe amount to increment (negative to decrement)
withKey
-
key
Set the key. If not set Riak will generate one.
Parameters:
-
key
Stringthe key in riak.
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.
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.