public class Namespace extends Object
Riak 2.0 introduced bucket types, which form a namespace in Riak when combined with a bucket name. This class encapsulates those two items for use with operations.
Buckets in Riak are automatically created for a type if they do not yet exist. Bucket types, on the other hand, are not. Anything other than the default bucket type must be explicitly created using the riak_admin command line tool.
Bucket types can only be in UTF-8. Bucket names have no restrictions.
Buckets in the default bucket type can not hold CRDTs (e.g. Maps, Counters, Sets, etc).
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_BUCKET_TYPE
The default bucket type in Riak.
|
Constructor and Description |
---|
Namespace(BinaryValue bucketName)
Construct a new Namespace with the provided bucket name and the default bucket type.
|
Namespace(BinaryValue bucketType,
BinaryValue bucketName)
Construct a new Namespace with the provided bucket type and name.
|
Namespace(String bucketName)
Construct a Namespace with the provided bucket name and the default bucket type.
|
Namespace(String bucketName,
Charset charset)
Construct a Namespace with the provided bucket name and the default bucket type.
|
Namespace(String bucketType,
String bucketName)
Construct a new Namespace with the provided bucket type and name.
|
Namespace(String bucketType,
String bucketName,
Charset charset)
Construct a new Namespace with the provided bucket type and name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
BinaryValue |
getBucketName()
Returns the bucket name for this Namespace.
|
String |
getBucketNameAsString()
Get the bucket name for this Namespace as a String.
|
String |
getBucketNameAsString(Charset charset)
Get the bucket name for this Namespace as a String.
|
BinaryValue |
getBucketType()
Returns the bucket type for this Namespace.
|
String |
getBucketTypeAsString()
Get the bucket type for this Namespace as a String.
|
String |
getBucketTypeAsString(Charset charset)
Get the bucket type for this Namespace as a String.
|
int |
hashCode() |
String |
toString() |
public static final String DEFAULT_BUCKET_TYPE
public Namespace(BinaryValue bucketType, BinaryValue bucketName)
bucketType
- The bucket type in Riak. This must be UTF-8 encoded.bucketName
- The bucket in Riak.public Namespace(String bucketType, String bucketName, Charset charset)
The supplied bucket type will be converted to bytes using UTF-8.
The supplied bucket name is converted to bytes using the supplied charset.
bucketType
- The bucket type in Riak. This must be a valid UTF-8 string.bucketName
- The name of the bucket in Riak.charset
- the charset used to convert the bucket name to bytes.public Namespace(String bucketType, String bucketName)
The bucket type will be converted to bytes using UTF-8.
The supplied bucketName is converted to bytes using the default charset.
bucketType
- The bucket type in Riak.bucketName
- The bucket in Riakpublic Namespace(BinaryValue bucketName)
The Namespace will use the default bucket type and the bucket name provided.
bucketName
- the bucket name in Riak.DEFAULT_BUCKET_TYPE
public Namespace(String bucketName, Charset charset)
The Namespace will use the default bucket type and the bucket name provided.
The supplied bucket name will be converted to bytes using the supplied charset.
bucketName
- the name of the bucket.charset
- the charset to use to convert the string to bytes.DEFAULT_BUCKET_TYPE
public Namespace(String bucketName)
The Namespace will use the default bucket type and the bucket name provided.
The supplied bucket name will be converted to bytes using the default charset.
bucketName
- the name of the bucket.DEFAULT_BUCKET_TYPE
public BinaryValue getBucketType()
public String getBucketTypeAsString()
The default Charset is used to convert to a String.
public String getBucketTypeAsString(Charset charset)
The supplied Charset is used to convert to a String.
charset
- The Charset used to convert to a String.public BinaryValue getBucketName()
public String getBucketNameAsString()
The default Charset is used.
public String getBucketNameAsString(Charset charset)
The supplied Charset is used.
charset
- the Charset used to convert to a String.Copyright © 2016. All rights reserved.