|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.tree.INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
com.sleepycat.je.tree.INKeyRep
com.sleepycat.je.tree.INKeyRep.MaxKeySize
public static class INKeyRep.MaxKeySize
The compact representation that can be used to represent keys LTE 16 bytes in length. The keys are all represented inside a single byte array instead of having one byte array per key. Within the array, all keys are assigned a storage size equal to that taken up by the largest key, plus one byte to hold the actual key length. This makes key retreival fast. However, insertion and deletion for larger keys move bytes proportional to the storage length of the keys. This is why the representation is restricted to keys LTE 16 bytes in size. On a 32 bit VM the per key overhead for the Default representation is 4 bytes for the pointer + 16 bytes for each byte array key object, for a total of 20 bytes/key. On a 64 bit machine the overheads are much larger: 8 bytes for the pointer plus 24 bytes per key. The more fully populated the IN the more the savings with this representation since the single byte array is sized to hold all the keys regardless of the actual number of keys that are present. It's worth noting that the storage savings here are realized in addition to the storage benefits of key prefixing, since the keys stored in the key array are the smaller key values after the prefix has been stripped, reducing the length of the key and making it more likely that it's small enough for this specialized representation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.sleepycat.je.tree.INKeyRep |
---|
INKeyRep.Default, INKeyRep.MaxKeySize, INKeyRep.Type |
Field Summary | |
---|---|
static byte |
DEFAULT_MAX_KEY_LENGTH
|
static int |
MAX_KEYS
|
Constructor Summary | |
---|---|
INKeyRep.MaxKeySize(int nodeMaxEntries,
short maxKeySize)
|
|
INKeyRep.MaxKeySize(SizeofMarker marker)
|
Method Summary | |
---|---|
boolean |
accountsForKeyByteMemUsage()
Returns true if the key bytes mem usage is accounted for internally here, or false if each key has a separate byte array and its mem usage is accounted for by the parent. |
long |
calculateMemorySize()
Returns the current memory size of the underlying representation in bytes. |
INKeyRep |
compact(IN parent)
Chooses a more compact representation, if that's possible, otherwise does nothing. |
INKeyRep |
copy(int from,
int to,
int n,
IN parent)
Copies n elements at index denoted by "from" to the index denoted by "to". |
byte[] |
get(int idx)
Returns the element at idx. |
INKeyRep.Type |
getType()
|
int |
length()
|
INKeyRep |
set(int idx,
byte[] key,
IN parent)
Sets the array element at idx to the node. |
(package private) void |
updateCacheStats(boolean increment,
Evictor evictor)
Update the cache statistics for this representation. |
Methods inherited from class com.sleepycat.je.tree.INArrayRep |
---|
noteRepChange, updateCacheStats |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte DEFAULT_MAX_KEY_LENGTH
public static final int MAX_KEYS
Constructor Detail |
---|
public INKeyRep.MaxKeySize(int nodeMaxEntries, short maxKeySize)
public INKeyRep.MaxKeySize(SizeofMarker marker)
Method Detail |
---|
public INKeyRep.Type getType()
getType
in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
public INKeyRep copy(int from, int to, int n, IN parent)
INArrayRep
copy
in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
from
- the source (inclusive) of the copyto
- the target (inclusive) of the copyn
- the number of elements to be copied.
public byte[] get(int idx)
INArrayRep
get
in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
public INKeyRep set(int idx, byte[] key, IN parent)
INArrayRep
set
in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
idx
- the index to be setkey
- the array elelement at the idx
public long calculateMemorySize()
INArrayRep
calculateMemorySize
in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
public int length()
length
in class INKeyRep
public boolean accountsForKeyByteMemUsage()
INKeyRep
accountsForKeyByteMemUsage
in class INKeyRep
public INKeyRep compact(IN parent)
INArrayRep
WARNING: This method must not change the memory size of the current representation and return 'this', without explicitly adjusting memory usage (via noteRepChange) before returning. Returning a new instance is the trigger for adjusting memory usage in the parent.
compact
in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
void updateCacheStats(boolean increment, Evictor evictor)
INArrayRep
updateCacheStats
in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
increment
- true the stat should be incremented, false if it must
be decrementedevictor
- the evictor that shoulds ths stat counters#updateCacheStats(boolean)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |