public final class Key extends Object
Modifier and Type | Field and Description |
---|---|
byte[] |
digest
Unique server hash value generated from set name and user key.
|
String |
namespace
Namespace.
|
String |
setName
Optional set name.
|
Value |
userKey
Original user key.
|
Constructor and Description |
---|
Key(String namespace,
byte[] digest,
String setName,
Value userKey)
Initialize key from namespace, digest, optional set name and optional userKey.
|
Key(String namespace,
String setName,
byte[] key)
Initialize key from namespace, optional set name and user key.
|
Key(String namespace,
String setName,
byte[] key,
int offset,
int length)
Initialize key from namespace, optional set name and user key.
|
Key(String namespace,
String setName,
int key)
Initialize key from namespace, optional set name and user key.
|
Key(String namespace,
String setName,
long key)
Initialize key from namespace, optional set name and user key.
|
Key(String namespace,
String setName,
String key)
Initialize key from namespace, optional set name and user key.
|
Key(String namespace,
String setName,
Value key)
Initialize key from namespace, optional set name and user key.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
computeDigest(String setName,
Value key)
Generate unique server hash value from set name, key type and user defined key.
|
boolean |
equals(Object obj)
Equality uses namespace and digest.
|
int |
hashCode()
Hash lookup uses namespace and digest.
|
String |
toString() |
public final String namespace
public final String setName
public final byte[] digest
public final Value userKey
public Key(String namespace, String setName, String key) throws AerospikeException
The key is converted to bytes to compute the digest. The key's byte size is limited to the current thread's buffer size (min 8KB). To store keys > 8KB, do one of the following:
ThreadLocalData.DefaultBufferSize = maxKeySize + maxSetNameSize + 1;
int len = key.length() + setName.length() + 1;
if (len > ThreadLocalData.getBuffer().length))
ThreadLocalData.resizeBuffer(len);
namespace
- namespacesetName
- optional set name, enter null when set does not existkey
- user defined unique identifier within set.AerospikeException
- if digest computation failspublic Key(String namespace, String setName, byte[] key) throws AerospikeException
The key's byte size is limited to the current thread's buffer size (min 8KB). To store keys > 8KB, do one of the following:
ThreadLocalData.DefaultBufferSize = maxKeySize + maxSetNameSize + 1;
int len = key.length + setName.length() + 1;
if (len > ThreadLocalData.getBuffer().length))
ThreadLocalData.resizeBuffer(len);
namespace
- namespacesetName
- optional set name, enter null when set does not existkey
- user defined unique identifier within set.AerospikeException
- if digest computation failspublic Key(String namespace, String setName, byte[] key, int offset, int length) throws AerospikeException
The key's byte size is limited to the current thread's buffer size (min 8KB). To store keys > 8KB, do one of the following:
ThreadLocalData.DefaultBufferSize = maxKeySize + maxSetNameSize + 1;
int len = length + setName.length() + 1;
if (len > ThreadLocalData.getBuffer().length))
ThreadLocalData.resizeBuffer(len);
namespace
- namespacesetName
- optional set name, enter null when set does not existkey
- user defined unique identifier within set.offset
- byte array segment offsetlength
- byte array segment lengthAerospikeException
- if digest computation failspublic Key(String namespace, String setName, int key) throws AerospikeException
namespace
- namespacesetName
- optional set name, enter null when set does not existkey
- user defined unique identifier within set.AerospikeException
- if digest computation failspublic Key(String namespace, String setName, long key) throws AerospikeException
namespace
- namespacesetName
- optional set name, enter null when set does not existkey
- user defined unique identifier within set.AerospikeException
- if digest computation failspublic Key(String namespace, String setName, Value key) throws AerospikeException
namespace
- namespacesetName
- optional set name, enter null when set does not existkey
- user defined unique identifier within set.AerospikeException
- if digest computation failspublic Key(String namespace, byte[] digest, String setName, Value userKey)
namespace
- namespacedigest
- unique server hash valuesetName
- optional set name, enter null when set does not existuserKey
- optional original user key (not hash digest).public int hashCode()
public boolean equals(Object obj)
public static byte[] computeDigest(String setName, Value key) throws AerospikeException
setName
- optional set name, enter null when set does not existkey
- record identifier, unique within setAerospikeException
- if digest computation failsCopyright ? 2012–2018 Aerospike, Inc. All rights reserved.