com.basho.riak.client.bucket
Interface Bucket

All Superinterfaces:
BucketProperties
All Known Implementing Classes:
DefaultBucket

public interface Bucket
extends BucketProperties

The primary interface for working with Key/Value data in Riak, a factory for key/value RiakOperations.

Provides convenience methods for creating RiakOperations for storing byte[] and String data in Riak. Also provides methods for creating RiakOperations for storing Java Bean style POJOs in Riak. A Bucket is a factory for RiakOperations on Key/Value data.

Gives access to all the BucketProperties that the underlying API transport exposes. NOTE: soon this will be *all* the BucketProperties

Provides access to an Iterable for the keys in the bucket.

Author:
russell
See Also:
StoreObject, FetchObject, DeleteObject

Method Summary
 DeleteObject delete(String key)
          Creates a DeleteObject operation that will delete the data at key on execute().
<T> DeleteObject
delete(T o)
          Creates a DeleteObject operation that will delete the data at o's RiakKey annotated field value on execute().
 FetchObject<IRiakObject> fetch(String key)
          Creates a FetchObject that returns the data at key as an IRiakObject on execute().
<T> FetchObject<T>
fetch(String key, Class<T> type)
          Creates a FetchObject operation that returns the data at key as an instance of type T on execute().
<T> FetchObject<T>
fetch(T o)
          Creates a FetchObject operation that returns the data at o's annotated RiakKey field as an instance of type T on execute().
<T> FetchIndex<T>
fetchIndex(RiakIndex<T> index)
          Creates a FetchIndex operation for the given index name and type
 String getName()
          Get this Buckets name.
 Iterable<String> keys()
          An Iterable view of the keys stored in this bucket.
 StoreObject<IRiakObject> store(String key, byte[] value)
          Creates a StoreObject that will store a new IRiakObject.
 StoreObject<IRiakObject> store(String key, String value)
          Creates a StoreObject that will store a new IRiakObject.
<T> StoreObject<T>
store(String key, T o)
          Creates a StoreObject for storing o of type T at key on execute().
<T> StoreObject<T>
store(T o)
          Creates a StoreObject for storing o of type T on execute().
 
Methods inherited from interface com.basho.riak.client.bucket.BucketProperties
getAllowSiblings, getBackend, getBasicQuorum, getBigVClock, getChashKeyFunction, getDW, getLastWriteWins, getLinkWalkFunction, getNotFoundOK, getNVal, getOldVClock, getPostcommitHooks, getPR, getPrecommitHooks, getPW, getR, getRW, getSearch, getSmallVClock, getW, getYoungVClock, isSearchEnabled
 

Method Detail

getName

String getName()
Get this Buckets name.

Returns:
the name of the bucket

store

StoreObject<IRiakObject> store(String key,
                               byte[] value)
Creates a StoreObject that will store a new IRiakObject.

Parameters:
key - the key to store the data under.
value - the data as a byte[]
Returns:
a StoreObject
See Also:
StoreObject

store

StoreObject<IRiakObject> store(String key,
                               String value)
Creates a StoreObject that will store a new IRiakObject.

Parameters:
key - the key to store the data under.
value - the data as a string
Returns:
a StoreObject
See Also:
StoreObject

store

<T> StoreObject<T> store(T o)
Creates a StoreObject for storing o of type T on execute(). T must have a field annotated with RiakKey.

Type Parameters:
T - the Type of o
Parameters:
o - the data to store
Returns:
a StoreObject
See Also:
StoreObject

store

<T> StoreObject<T> store(String key,
                         T o)
Creates a StoreObject for storing o of type T at key on execute().

Type Parameters:
T - the Type of o
Parameters:
o - the data to store
key - the key
Returns:
a StoreObject
See Also:
StoreObject

fetch

FetchObject<IRiakObject> fetch(String key)
Creates a FetchObject that returns the data at key as an IRiakObject on execute().

Parameters:
key - the key
Returns:
a FetchObject
See Also:
FetchObject

fetch

<T> FetchObject<T> fetch(String key,
                         Class<T> type)
Creates a FetchObject operation that returns the data at key as an instance of type T on execute().

Type Parameters:
T - the Type to return
Parameters:
key - the key under which the data is stored
type - the Class of the type to return
Returns:
a FetchObject
See Also:
FetchObject

fetch

<T> FetchObject<T> fetch(T o)
Creates a FetchObject operation that returns the data at o's annotated RiakKey field as an instance of type T on execute().

Type Parameters:
T - the Type to return
Parameters:
o - an instance ot T that has the key annotated with RiakKey
Returns:
a FetchObject
See Also:
FetchObject

delete

<T> DeleteObject delete(T o)
Creates a DeleteObject operation that will delete the data at o's RiakKey annotated field value on execute().

Type Parameters:
T - the Type of o
Parameters:
o - an instance of T with a value for the key in the field annotated by RiakKey
Returns:
a DeleteObject
See Also:
DeleteObject

delete

DeleteObject delete(String key)
Creates a DeleteObject operation that will delete the data at key on execute().

Type Parameters:
T - the Type of o
Parameters:
o - an instance of T with a value for the key in the field annotated by RiakKey
Returns:
a DeleteObject
See Also:
DeleteObject

keys

Iterable<String> keys()
                      throws RiakException
An Iterable view of the keys stored in this bucket.

Returns:
an Iterable of Strings.
Throws:
RiakException

fetchIndex

<T> FetchIndex<T> fetchIndex(RiakIndex<T> index)
Creates a FetchIndex operation for the given index name and type

Type Parameters:
T - the index type (currently String or Integer)
Parameters:
index - an index
Returns:
a FetchIndex operation for further configuration and execution


Copyright © 2012. All Rights Reserved.