public class GridUnsafeMap extends Object implements GridOffHeapMap
Unsafe implementation.| Constructor and Description |
|---|
GridUnsafeMap(int concurrency,
float load,
long initCap,
long totalMem,
short lruStripes,
@Nullable GridOffHeapEvictListener evictLsnr) |
| Modifier and Type | Method and Description |
|---|---|
long |
allocatedSize()
Gets memory allocated for map entries so far.
|
int |
concurrency()
Gets concurrency level for this map.
|
boolean |
contains(int hash,
byte[] keyBytes)
Checks if given key is contained in the map.
|
void |
destruct()
Destructs this map and deallocates all memory.
|
void |
enableEviction(int hash,
byte[] keyBytes)
Enables eviction for given key.
|
boolean |
eventListener(GridOffHeapEventListener evtLsnr)
Adds off-heap event listener.
|
boolean |
evictListener(GridOffHeapEvictListener evictLsnr)
Sets callback for when entries are evicted due to memory constraints.
|
long |
freeSize()
Gets available memory.
|
byte[] |
get(int hash,
byte[] keyBytes)
Gets value bytes for given key.
|
void |
insert(int hash,
byte[] keyBytes,
byte[] valBytes)
Inserts new entry into the map without comparing if there is
a mapping for given key already stored in map.
|
GridCloseableIterator<IgniteBiTuple<byte[],byte[]>> |
iterator()
Gets iterator over map.
|
<T> GridCloseableIterator<T> |
iterator(CX2<T2<Long,Integer>,T2<Long,Integer>,T> c)
Gets iterator over map.
|
float |
loadFactor()
Gets load factor of this map.
|
long |
lruMemorySize()
Gets memory size occupied by LRU queue.
|
long |
lruSize()
Gets number of elements in LRU queue.
|
short |
lruStripes()
Gets number of LRU stripes.
|
long |
memorySize()
Gets total available memory size.
|
int |
partition()
Gets partition this map belongs to.
|
boolean |
put(int hash,
byte[] keyBytes,
byte[] valBytes)
Puts key and value bytes into the map potentially replacing
existing entry.
|
byte[] |
remove(int hash,
byte[] keyBytes)
Removes value from off-heap map.
|
boolean |
removex(int hash,
byte[] keyBytes)
Removes value from off-heap map without returning it.
|
boolean |
removex(int hash,
byte[] keyBytes,
IgniteBiPredicate<Long,Integer> p)
Removes value from off-heap map without returning it.
|
long |
size()
Gets number of elements in the map.
|
long |
systemAllocatedSize()
Gets memory allocated for map internal structure so far.
|
long |
totalSize()
Gets number of elements in the map.
|
@Nullable IgniteBiTuple<Long,Integer> |
valuePointer(int hash,
byte[] keyBytes)
Gets value pointer for given key.
|
public GridUnsafeMap(int concurrency,
float load,
long initCap,
long totalMem,
short lruStripes,
@Nullable
@Nullable GridOffHeapEvictListener evictLsnr)
concurrency - Concurrency.load - Load factor.initCap - Initial capacity.totalMem - Total memory.lruStripes - Number of LRU stripes.evictLsnr - Eviction listener.public boolean eventListener(GridOffHeapEventListener evtLsnr)
eventListener in interface GridOffHeapMapevtLsnr - Listener.True if event listener was added, false if
another listener already exists.public boolean evictListener(GridOffHeapEvictListener evictLsnr)
evictListener in interface GridOffHeapMapevictLsnr - Evict listener.True if evict listener was added, false if
another listener already exists or LRU is disabled.public int partition()
partition in interface GridOffHeapMappublic float loadFactor()
loadFactor in interface GridOffHeapMappublic int concurrency()
concurrency in interface GridOffHeapMappublic boolean contains(int hash,
byte[] keyBytes)
contains in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.True if key is contained in the map.public byte[] get(int hash,
byte[] keyBytes)
get in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.@Nullable public @Nullable IgniteBiTuple<Long,Integer> valuePointer(int hash, byte[] keyBytes)
valuePointer in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.public void enableEviction(int hash,
byte[] keyBytes)
enableEviction in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.public byte[] remove(int hash,
byte[] keyBytes)
remove in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.public boolean removex(int hash,
byte[] keyBytes)
removex in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.True if value was removed.public boolean removex(int hash,
byte[] keyBytes,
IgniteBiPredicate<Long,Integer> p)
removex in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.p - Value predicate (arguments are value address and value length).True if value was removed.public boolean put(int hash,
byte[] keyBytes,
byte[] valBytes)
put in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.valBytes - Value bytes.True if new entry was created, false if existing value was updated.public void insert(int hash,
byte[] keyBytes,
byte[] valBytes)
Use with caution whenever certain that inserting a new value without current mapping.
insert in interface GridOffHeapMaphash - Hash.keyBytes - Key bytes.valBytes - Value bytes.public long totalSize()
totalSize in interface GridOffHeapMappublic long size()
size in interface GridOffHeapMappublic long memorySize()
memorySize in interface GridOffHeapMappublic long allocatedSize()
allocatedSize in interface GridOffHeapMappublic long systemAllocatedSize()
systemAllocatedSize in interface GridOffHeapMappublic long freeSize()
freeSize in interface GridOffHeapMappublic void destruct()
destruct in interface GridOffHeapMappublic GridCloseableIterator<IgniteBiTuple<byte[],byte[]>> iterator()
iterator in interface GridOffHeapMappublic <T> GridCloseableIterator<T> iterator(CX2<T2<Long,Integer>,T2<Long,Integer>,T> c)
iterator in interface GridOffHeapMapc - Key/value closure.public short lruStripes()
public long lruMemorySize()
public long lruSize()
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.11.1 Release Date : December 20 2021