public class HashSlotArray16byteKeyImpl extends HashSlotArrayBase implements HashSlotArray16byteKey
HashSlotArray16byteKey
.
This class uses the first 8 bytes of the value block for the unassigned sentinel.
It is the responsibility of the caller to ensure that the unassigned sentinel
is overwritten with a non-sentinel value as soon as a new slot is assigned (after calling
ensure(long, long)
and getting a positive return value).
For the same reason this class must not be instantiated with zero value length. Use
HashSlotArray16byteKeyNoValue
as a zero-length key implementation.
HashSlotArrayBase.Cursor, HashSlotArrayBase.CursorIntKey2, HashSlotArrayBase.CursorLongKey2
CAPACITY_OFFSET, EXPAND_THRESHOLD_OFFSET, HEADER_SIZE, KEY_1_OFFSET, KEY_2_OFFSET, offsetOfUnassignedSentinel, SIZE_OFFSET, slotLength, unassignedSentinel, VALUE_SIZE_GRANULARITY
Modifier | Constructor and Description |
---|---|
protected |
HashSlotArray16byteKeyImpl(long nullSentinel,
long offsetOfNullSentinel,
MemoryManager mm,
MemoryAllocator auxMalloc,
int valueLength,
int initialCapacity,
float loadFactor) |
|
HashSlotArray16byteKeyImpl(long nullSentinel,
MemoryManager mm,
int valueLength) |
|
HashSlotArray16byteKeyImpl(long nullSentinel,
MemoryManager memMgr,
int valueLength,
int initialCapacity,
float loadFactor) |
|
HashSlotArray16byteKeyImpl(long nullSentinel,
MemoryManager memMgr,
MemoryAllocator auxMalloc,
int valueLength,
int initialCapacity,
float loadFactor) |
Modifier and Type | Method and Description |
---|---|
static long |
addrOfKey1At(long slotBase) |
static long |
addrOfKey2At(long slotBase) |
static long |
addrOfValueAt(long slotBase) |
HashSlotCursor16byteKey |
cursor()
Returns a cursor over all assigned slots in this array.
|
SlotAssignmentResult |
ensure(long key1,
long key2)
Ensures that there is a mapping from
(key1, key2) to a slot in the
array. |
long |
get(long key1,
long key2)
Returns the address of the value block mapped by
(key1, key2) . |
boolean |
remove(long key1,
long key2)
Removes the mapping for
(key1, key2) , if any. |
static long |
valueAddr2slotBase(long valueAddr) |
protected boolean |
valueLengthValid(int valueLength) |
address, allocateArrayAndAdjustFields, assertValid, capacity, clear, dispose, ensure0, equal, expansionThreshold, get0, gotoAddress, gotoNew, isAssigned, key1OfSlot, key2OfSlot, keyHash, malloc, markUnassigned, mem, migrateTo, putKey, rehash, remove0, resizeTo, setMemMgr, shiftConflictingKeys, size, slotBase, slotHash, trimToSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
address, capacity, clear, expansionThreshold, gotoAddress, gotoNew, size, trimToSize
dispose
public HashSlotArray16byteKeyImpl(long nullSentinel, MemoryManager memMgr, MemoryAllocator auxMalloc, int valueLength, int initialCapacity, float loadFactor)
public HashSlotArray16byteKeyImpl(long nullSentinel, MemoryManager memMgr, int valueLength, int initialCapacity, float loadFactor)
public HashSlotArray16byteKeyImpl(long nullSentinel, MemoryManager mm, int valueLength)
protected HashSlotArray16byteKeyImpl(long nullSentinel, long offsetOfNullSentinel, MemoryManager mm, MemoryAllocator auxMalloc, int valueLength, int initialCapacity, float loadFactor)
public SlotAssignmentResult ensure(long key1, long key2)
(key1, key2)
to a slot in the
array.
The returned object contains the slot value block address and whether a new
slot had to be assigned. The hash slot array implementation keeps a reference
to the returned object and will always return the same instance, albeit with
updated fields on each new invocation.
This means the returned object is valid until the next invocation of this
method.
Whenever this method returns a newly assigned slot, the caller must ensure that the null-sentinel value at the returned address is overwritten with a non-sentinel value.
ensure
in interface HashSlotArray16byteKey
key1
- key part 1key2
- key part 2SlotAssignmentResult.isNew()
public long get(long key1, long key2)
HashSlotArray16byteKey
(key1, key2)
.get
in interface HashSlotArray16byteKey
key1
- key part 1key2
- key part 2MemoryAllocator.NULL_ADDRESS
if no mapping for (key1, key2)
exists.public boolean remove(long key1, long key2)
HashSlotArray16byteKey
(key1, key2)
, if any.remove
in interface HashSlotArray16byteKey
key1
- key part 1key2
- key part 2public HashSlotCursor16byteKey cursor()
HashSlotArray16byteKey
cursor
in interface HashSlotArray16byteKey
protected boolean valueLengthValid(int valueLength)
public static long addrOfKey1At(long slotBase)
public static long addrOfKey2At(long slotBase)
public static long addrOfValueAt(long slotBase)
public static long valueAddr2slotBase(long valueAddr)
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.