|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.dbi.DupKeyData
public class DupKeyData
Utility methods for combining, splitting and comparing two-part key values for duplicates databases. At the Btree storage level, for the key/data pairs in a duplicates database, the data is always zero length and the key is a two-part key. The 'key' parameter in the API is the first part of the key. The the 'data' parameter in the API is the second part of the key. The length of the first part is stored at the end of the combined key as a packed integer, so that the two parts can be split, combined, and compared separately. The length is stored at the end, rather than the start, to enable key prefixing for the first part, e.g., for Strings with different lengths but common prefixes.
Nested Class Summary | |
---|---|
static class |
DupKeyData.NextNoDupComparator
Used to perform the getNextNoDup operation. |
static class |
DupKeyData.PutNoOverwriteComparator
Used to perform the putNoOverwrite operation. |
static class |
DupKeyData.TwoPartKeyComparator
Comparator that compares the combined key/data two-part key, calling the user-defined btree and duplicate comparator as needed. |
Constructor Summary | |
---|---|
DupKeyData()
|
Method Summary | |
---|---|
static byte[] |
combine(byte[] key,
byte[] data)
|
static byte[] |
combine(byte[] key,
int keyOff,
int keySize,
byte[] data,
int dataOff,
int dataSize)
|
static DatabaseEntry |
combine(DatabaseEntry paramKey,
DatabaseEntry paramData)
Returns twoPartKey as: paramKey bytes, paramData bytes, reverse-packed len of paramKey bytes. |
static int |
compareMainKey(byte[] keyBytes1,
byte[] keyBytes2,
Comparator<byte[]> btreeComparator)
Compares the first part of the two keys. |
static int |
compareMainKey(byte[] keyBytes1,
byte[] keyBytes2,
int keyOff2,
int keySize2,
Comparator<byte[]> btreeComparator)
Compares the first part of the two keys. |
static byte[] |
makePrefixKey(byte[] key,
int keyOff,
int keySize)
Returns a two-part key entry with the given key portion, no data, and the special PREFIX_ONLY value for the key length. |
static DatabaseEntry |
removeData(byte[] twoPartKey)
Splits twoPartKey and returns a two-part key entry containing the key portion from twoPartKey, no data, and the special PREFIX_ONLY value for the key length. |
static byte[] |
replaceData(byte[] twoPartKey,
byte[] newData)
Splits twoPartKey and returns a two-part key entry containing the key portion of twoPartKey combined with newData. |
static void |
split(byte[] twoPartKey,
int twoPartKeySize,
DatabaseEntry paramKey,
DatabaseEntry paramData)
Same as split method above, but with twoPartKey/twoPartKeySize byte array and array size params. |
static void |
split(DatabaseEntry twoPartKey,
DatabaseEntry paramKey,
DatabaseEntry paramData)
Splits twoPartKey, previously set by combine, into original paramKey and paramData if they are non-null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DupKeyData()
Method Detail |
---|
public static DatabaseEntry combine(DatabaseEntry paramKey, DatabaseEntry paramData)
public static byte[] combine(byte[] key, byte[] data)
public static byte[] combine(byte[] key, int keyOff, int keySize, byte[] data, int dataOff, int dataSize)
public static void split(DatabaseEntry twoPartKey, DatabaseEntry paramKey, DatabaseEntry paramData)
public static void split(byte[] twoPartKey, int twoPartKeySize, DatabaseEntry paramKey, DatabaseEntry paramData)
public static byte[] replaceData(byte[] twoPartKey, byte[] newData)
public static DatabaseEntry removeData(byte[] twoPartKey)
public static byte[] makePrefixKey(byte[] key, int keyOff, int keySize)
public static int compareMainKey(byte[] keyBytes1, byte[] keyBytes2, Comparator<byte[]> btreeComparator)
public static int compareMainKey(byte[] keyBytes1, byte[] keyBytes2, int keyOff2, int keySize2, Comparator<byte[]> btreeComparator)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |