public class RobinHoodBackwardShiftHashMap extends Object implements LoadedPagesMap
LoadedPagesMap.KeyPredicate| Constructor and Description |
|---|
RobinHoodBackwardShiftHashMap(long baseAddr,
long size)
Creates map in preallocated unsafe memory segment.
|
| Modifier and Type | Method and Description |
|---|---|
int |
capacity() |
String |
dump() |
void |
forEach(BiConsumer<FullPageId,Long> act)
Scans all the elements in this table.
|
long |
get(int grpId,
long pageId,
int reqVer,
long absent,
long outdated)
Gets value associated with the given key.
|
ReplaceCandidate |
getNearestAt(int idxStart)
Find nearest presented value from specified position to the right.
|
void |
put(int grpId,
long pageId,
long val,
int ver)
Associates the given key with the given value.
|
long |
refresh(int grpId,
long pageId,
int ver)
Refresh outdated value.
|
boolean |
remove(int grpId,
long pageId)
Removes key-value association for the given key.
|
GridLongList |
removeIf(int startIdxToClear,
int endIdxToClear,
LoadedPagesMap.KeyPredicate keyPred)
Removes entities matching provided predicate at specified mapping range.
|
static long |
requiredMemory(long elementsCnt) |
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitremoveIfpublic RobinHoodBackwardShiftHashMap(long baseAddr,
long size)
baseAddr - Base buffer address.size - Size available for map, number of buckets (cells) to store will be determined accordingly.public static long requiredMemory(long elementsCnt)
elementsCnt - Maximum elements can be stored in map, its maximum size.public long get(int grpId,
long pageId,
int reqVer,
long absent,
long outdated)
get in interface LoadedPagesMapgrpId - Cache Group ID. First part of the key.pageId - Page ID. Second part of the key.reqVer - Requested entry version, counter associated with value.absent - return if provided page is not presented in map.outdated - return if provided reqVer version is greater than value in map (was used for put).public void put(int grpId,
long pageId,
long val,
int ver)
put in interface LoadedPagesMapgrpId - Cache Group ID. First part of the key.pageId - Page ID. Second part of the key.val - Value to set.ver - Version/counter associated with value, can be used to check if value is outdated.public boolean remove(int grpId,
long pageId)
remove in interface LoadedPagesMapgrpId - First part of the key. Cache Group ID.pageId - Second part of the key. Page ID.True if value was actually found and removed.public ReplaceCandidate getNearestAt(int idxStart)
getNearestAt in interface LoadedPagesMapidxStart - Index to start searching from. Bounded with LoadedPagesMap.capacity().null value that will
be returned if no values present.public long refresh(int grpId,
long pageId,
int ver)
LoadedPagesMap.get(int, long, int, long, long) returned outdated return value.refresh in interface LoadedPagesMapgrpId - First part of the key. Cache Group ID.pageId - Second part of the key. Page ID.ver - Partition tag.public GridLongList removeIf(int startIdxToClear, int endIdxToClear, LoadedPagesMap.KeyPredicate keyPred)
removeIf in interface LoadedPagesMapstartIdxToClear - Index to clear value at, inclusive. Bounded with LoadedPagesMap.capacity().endIdxToClear - Index to clear value at, inclusive. Bounded with LoadedPagesMap.capacity().keyPred - Test predicate for (cache group ID, page ID).public int capacity()
capacity in interface LoadedPagesMappublic String dump()
public final int size()
size in interface LoadedPagesMappublic void forEach(BiConsumer<FullPageId,Long> act)
forEach in interface LoadedPagesMapact - Visitor/action to be applied to each not empty cell.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.6.0 Release Date : July 10 2018