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
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
chashKeyFunction(NamedErlangFunction chashKeyFunction)
Set the chash_key_fun on the bucket to be written
NOTE: at present this is not supported by the PB API and has no effect for that client.
|
WriteBucket |
disableSearch()
convenience for setting search=false **and** removing the search
precommit hook (support for both pre-1.0 and 1.0 search) NOTE: at present
this is not supported by PB API and an
UnsupportedPropertyException will be thrown if called for that
transport |
WriteBucket |
dw(int dw)
The default dw quorom as an int
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
dw(Quora dw)
The default dw quorom
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
enableForSearch()
convenience for setting search=true **and** adding the search precommit
hook (support for both pre-1.0 and 1.0 search)
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
Bucket |
execute()
Creates/updates a Bucket in Riak with the set of properties configured.
|
WriteBucket |
lastWriteWins(boolean lastWriteWins)
Is this bucket last_write_wins?
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport. |
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
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
nVal(int nVal)
The n_val for this bucket
|
WriteBucket |
oldVClock(long oldVClock)
set the old_vclock prune age
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
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
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
pr(Quora pr)
The default pr quorom
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
precommitHooks(Collection<NamedFunction> precommitHooks)
A Collection of precommit hooks for this bucket
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
pw(int pw)
The default dw quorom as an int
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
pw(Quora pw)
The default pw quorom
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
r(int r)
The default r quorom as an int
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
r(Quora r)
The default r Quorom for the bucket
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
rw(int rw)
The default rw quorom as an int
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
rw(Quora rw)
The default rw quorom
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
smallVClock(int smallVClock)
set the small vclock prune size
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
w(int w)
The default w quorom as an int
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
w(Quora w)
The default w quorom
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
WriteBucket |
withRetrier(Retrier retrier)
Specify the retrier to use for this operation.
|
WriteBucket |
youngVClock(long youngVClock)
set the young_vclock prune age
NOTE: at present this is not supported by PB API and
an
UnsupportedPropertyException will be thrown if called for that transport |
public Bucket execute() throws RiakRetryFailedException
execute
in interface RiakOperation<Bucket>
Bucket
RiakRetryFailedException
public WriteBucket allowSiblings(boolean allowSiblings)
allowSiblings
- public WriteBucket lastWriteWins(boolean lastWriteWins)
UnsupportedPropertyException
will be thrown if called for that transport.lastWriteWins
- public WriteBucket nVal(int nVal)
nVal
- public WriteBucket backend(String backend)
UnsupportedPropertyException
will be thrown if called for that transportbackend
- public WriteBucket precommitHooks(Collection<NamedFunction> precommitHooks)
UnsupportedPropertyException
will be thrown if called for that transportprecommitHooks
- public WriteBucket addPrecommitHook(NamedFunction preCommitHook)
UnsupportedPropertyException
will be thrown if called for that transportpreCommitHook
- public WriteBucket postcommitHooks(Collection<NamedErlangFunction> postCommitHooks)
UnsupportedPropertyException
will be thrown if called for that transportpostCommitHooks
- 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)
UnsupportedPropertyException
will be thrown if called for that transportsmallVClock
- public WriteBucket bigVClock(int bigVClock)
UnsupportedPropertyException
will be thrown if called for that transportbigVClock
- public WriteBucket youngVClock(long youngVClock)
UnsupportedPropertyException
will be thrown if called for that transportyoungVClock
- public WriteBucket oldVClock(long oldVClock)
UnsupportedPropertyException
will be thrown if called for that transportoldVClock
- public WriteBucket r(Quora r)
UnsupportedPropertyException
will be thrown if called for that transportr
- public WriteBucket r(int r)
UnsupportedPropertyException
will be thrown if called for that transportr
- public WriteBucket w(Quora w)
UnsupportedPropertyException
will be thrown if called for that transportw
- public WriteBucket w(int w)
UnsupportedPropertyException
will be thrown if called for that transportw
- public WriteBucket rw(Quora rw)
UnsupportedPropertyException
will be thrown if called for that transportrw
- public WriteBucket rw(int rw)
UnsupportedPropertyException
will be thrown if called for that transportrw
- public WriteBucket dw(Quora dw)
UnsupportedPropertyException
will be thrown if called for that transportdw
- public WriteBucket dw(int dw)
UnsupportedPropertyException
will be thrown if called for that transportdw
- public WriteBucket pr(Quora pr)
UnsupportedPropertyException
will be thrown if called for that transportpr
- public WriteBucket pr(int pr)
UnsupportedPropertyException
will be thrown if called for that transportpr
- public WriteBucket pw(Quora pw)
UnsupportedPropertyException
will be thrown if called for that transportpw
- public WriteBucket pw(int pw)
UnsupportedPropertyException
will be thrown if called for that transportdw
- public WriteBucket basicQuorum(boolean basicQuorum)
UnsupportedPropertyException
will be thrown if called for that transportbasicQuorum
- public WriteBucket notFoundOK(boolean notFoundOK)
UnsupportedPropertyException
will be thrown if called for that transportnotFoundOK
- public WriteBucket withRetrier(Retrier retrier)
retrier
- a Retrier to use for the execute operationpublic WriteBucket enableForSearch()
UnsupportedPropertyException
will be thrown if called for that transportpublic WriteBucket disableSearch()
UnsupportedPropertyException
will be thrown if called for that
transportpublic 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 © 2012. All Rights Reserved.