public class WriteBucket extends Object implements RiakOperation<Bucket>
RiakOperation
for creating/updating a Bucket
.
This class is a fluid builder for creating a RiakOperation
that sets
bucket properties on a bucket in Riak. It delegates to a
BucketPropertiesBuilder
then uses its RawClient
and
Retrier
to set the bucket properties in Riak.
NOTE: all the parameters on the builder are optional. If omitted then the Riak defaults will be used. Also, very few of these properties are supported by both underlying APIs at present. They are here for completeness sake. Changes are underway to support all the properties. Check the docs for the individual parameters to see what is supported.
Constructor and Description |
---|
WriteBucket(RawClient client,
Bucket bucket,
Retrier retrier)
|
WriteBucket(RawClient client,
String name,
Retrier retrier)
|
Modifier and Type | Method and Description |
---|---|
WriteBucket |
addPostcommitHook(NamedErlangFunction postcommitHook)
Add a postcommit hook to the Collection of post commit hooks for the bucket to written.
|
WriteBucket |
addPrecommitHook(NamedFunction preCommitHook)
Add a precommit hook to the Collection of hooks to be written.
|
WriteBucket |
allowSiblings(boolean allowSiblings)
Should the bucket have allow_mult set to true?
|
WriteBucket |
backend(String backend)
Which backend this bucket uses.
|
WriteBucket |
basicQuorum(boolean basicQuorum)
The default basic_quorum value
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
bigVClock(int bigVClock)
set the big_vclock prune size
|
WriteBucket |
chashKeyFunction(NamedErlangFunction chashKeyFunction)
Set the chash_key_fun on the bucket to be written
|
WriteBucket |
disableSearch()
convenience for setting search=false **and** removing the search
precommit hook (support for both pre-1.0 and 1.0 search)
|
WriteBucket |
dw(int dw)
The default dw quorom as an int
|
WriteBucket |
dw(Quora dw)
The default dw quorom
|
WriteBucket |
enableForSearch()
convenience for setting search=true **and** adding the search precommit
hook (support for both pre-1.0 and 1.0 search)
|
Bucket |
execute()
Creates/updates a Bucket in Riak with the set of properties configured.
|
WriteBucket |
lastWriteWins(boolean lastWriteWins)
Is this bucket last_write_wins?
|
WriteBucket |
lazyLoadBucketProperties()
Prior to the addition of this method there was no way to prevent
execute() from fetching the BucketProperties from Riak
after storing any modifications made via this object. |
WriteBucket |
linkWalkFunction(NamedErlangFunction linkWalkFunction)
Set the link_walk_fun used by Riak on the bucket to be written.
|
WriteBucket |
notFoundOK(boolean notFoundOK)
The default notfound_ok value
|
WriteBucket |
nVal(int nVal)
The n_val for this bucket
|
WriteBucket |
oldVClock(long oldVClock)
set the old_vclock prune age
|
WriteBucket |
postcommitHooks(Collection<NamedErlangFunction> postCommitHooks)
Add a collection of postcommit hooks to the bucket to be written.
|
WriteBucket |
pr(int pr)
The default pr quorom as an int
|
WriteBucket |
pr(Quora pr)
The default pr quorom
|
WriteBucket |
precommitHooks(Collection<NamedFunction> precommitHooks)
A Collection of precommit hooks for this bucket
|
WriteBucket |
pw(int pw)
The default dw quorom as an int
|
WriteBucket |
pw(Quora pw)
The default pw quorom
|
WriteBucket |
r(int r)
The default r quorom as an int
|
WriteBucket |
r(Quora r)
The default r Quorom for the bucket
|
WriteBucket |
rw(int rw)
The default rw quorom as an int
|
WriteBucket |
rw(Quora rw)
The default rw quorom
|
WriteBucket |
smallVClock(int smallVClock)
set the small vclock prune size
|
WriteBucket |
w(int w)
The default w quorom as an int
|
WriteBucket |
w(Quora w)
The default w quorom
|
WriteBucket |
withRetrier(Retrier retrier)
Specify the retrier to use for this operation.
|
WriteBucket |
youngVClock(long youngVClock)
set the young_vclock prune age
|
public Bucket execute() throws RiakRetryFailedException
execute
in interface RiakOperation<Bucket>
Bucket
RiakRetryFailedException
public WriteBucket allowSiblings(boolean allowSiblings)
allowSiblings
- public WriteBucket lastWriteWins(boolean lastWriteWins)
lastWriteWins
- public WriteBucket nVal(int nVal)
nVal
- public WriteBucket backend(String backend)
backend
- public WriteBucket precommitHooks(Collection<NamedFunction> precommitHooks)
precommitHooks
- public WriteBucket addPrecommitHook(NamedFunction preCommitHook)
preCommitHook
- public WriteBucket postcommitHooks(Collection<NamedErlangFunction> postCommitHooks)
postCommitHooks
- public WriteBucket addPostcommitHook(NamedErlangFunction postcommitHook)
UnsupportedPropertyException
will be thrown if called for that transportpostcommitHook
- public WriteBucket chashKeyFunction(NamedErlangFunction chashKeyFunction)
chashKeyFunction
- public WriteBucket linkWalkFunction(NamedErlangFunction linkWalkFunction)
linkWalkFunction
- public WriteBucket smallVClock(int smallVClock)
smallVClock
- public WriteBucket bigVClock(int bigVClock)
bigVClock
- public WriteBucket youngVClock(long youngVClock)
youngVClock
- public WriteBucket oldVClock(long oldVClock)
oldVClock
- public WriteBucket r(Quora r)
r
- public WriteBucket r(int r)
r
- public WriteBucket w(Quora w)
w
- public WriteBucket w(int w)
w
- public WriteBucket rw(Quora rw)
rw
- public WriteBucket rw(int rw)
rw
- public WriteBucket dw(Quora dw)
dw
- public WriteBucket dw(int dw)
dw
- public WriteBucket pr(Quora pr)
pr
- public WriteBucket pr(int pr)
pr
- public WriteBucket pw(Quora pw)
pw
- public WriteBucket pw(int pw)
dw
- public WriteBucket basicQuorum(boolean basicQuorum)
UnsupportedPropertyException
will be thrown if called for that transportbasicQuorum
- public WriteBucket notFoundOK(boolean notFoundOK)
notFoundOK
- public WriteBucket withRetrier(Retrier retrier)
retrier
- a Retrier to use for the execute operationpublic WriteBucket enableForSearch()
public WriteBucket disableSearch()
public WriteBucket lazyLoadBucketProperties()
execute()
from fetching the BucketProperties
from Riak
after storing any modifications made via this object.
Calling this prior to execute()
allows you to defer fetching
the bucket properties for this bucket from Riak
until they are required by one of the Bucket
methods that
accesses them (e.g. BucketProperties.getR()
). If none of those methods are
called then they are never retrieved.
Copyright © 2013. All Rights Reserved.