public class GridUnsafePartitionedMap extends Object implements GridOffHeapPartitionedMap
Unsafe implementation.| Constructor and Description |
|---|
GridUnsafePartitionedMap(int parts,
int concurrency,
float load,
long initCap,
long totalMem,
short lruStripes,
@Nullable GridOffHeapEvictListener evictLsnr) |
| Modifier and Type | Method and Description |
|---|---|
long |
allocatedSize()
Gets size of a memory allocated for map entries so far.
|
int |
concurrency()
Gets concurrency level for this map.
|
boolean |
contains(int part,
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 p,
int hash,
byte[] keyBytes)
Enables eviction for entry.
|
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 p,
int hash,
byte[] keyBytes)
Gets value bytes for given key.
|
void |
insert(int p,
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 the whole map.
|
<T> GridCloseableIterator<T> |
iterator(CX2<T2<Long,Integer>,T2<Long,Integer>,T> c)
Gets iterator over the whole map.
|
<T> GridCloseableIterator<T> |
iterator(CX2<T2<Long,Integer>,T2<Long,Integer>,T> c,
int part)
Gets iterator over the partition.
|
GridCloseableIterator<IgniteBiTuple<byte[],byte[]>> |
iterator(int p)
Gets iterator over certain partition.
|
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 |
partitions()
Gets number of partitions.
|
boolean |
put(int p,
int hash,
byte[] keyBytes,
byte[] valBytes)
Puts key and value bytes into the map potentially replacing
existing entry.
|
byte[] |
remove(int p,
int hash,
byte[] keyBytes)
Removes value from off-heap map.
|
boolean |
removex(int p,
int hash,
byte[] keyBytes)
Removes value from off-heap map without returning it.
|
boolean |
removex(int part,
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 |
size(Set<Integer> parts)
Gets number of elements in the map.
|
long |
systemAllocatedSize()
Gets memory allocated for map internal structure so far.
|
IgniteBiTuple<Long,Integer> |
valuePointer(int p,
int hash,
byte[] keyBytes)
Gets value pointer for given key.
|
public GridUnsafePartitionedMap(int parts,
int concurrency,
float load,
long initCap,
long totalMem,
short lruStripes,
@Nullable
@Nullable GridOffHeapEvictListener evictLsnr)
parts - Partitions.concurrency - Concurrency.load - Load factor.initCap - Initial capacity.totalMem - Total memory.lruStripes - LRU stripes.evictLsnr - Eviction callback.public float loadFactor()
loadFactor in interface GridOffHeapPartitionedMappublic int concurrency()
concurrency in interface GridOffHeapPartitionedMappublic int partitions()
partitions in interface GridOffHeapPartitionedMappublic boolean contains(int part,
int hash,
byte[] keyBytes)
contains in interface GridOffHeapPartitionedMappart - Partition.hash - Hash.keyBytes - Key bytes.True if key is contained in the map.public byte[] get(int p,
int hash,
byte[] keyBytes)
get in interface GridOffHeapPartitionedMapp - Partition.hash - Hash.keyBytes - Key bytes.public IgniteBiTuple<Long,Integer> valuePointer(int p, int hash, byte[] keyBytes)
GridOffHeapPartitionedMap.put(int, int, byte[], byte[]) or
GridOffHeapPartitionedMap.enableEviction(int, int, byte[]) is called.valuePointer in interface GridOffHeapPartitionedMapp - Partition.hash - Hash.keyBytes - Key bytes.public void enableEviction(int p,
int hash,
byte[] keyBytes)
enableEviction in interface GridOffHeapPartitionedMapp - Partition.hash - Hash.keyBytes - Key bytes.public byte[] remove(int p,
int hash,
byte[] keyBytes)
remove in interface GridOffHeapPartitionedMapp - Partition.hash - Hash.keyBytes - Key bytes.public boolean removex(int p,
int hash,
byte[] keyBytes)
removex in interface GridOffHeapPartitionedMapp - Partition.hash - Hash.keyBytes - Key bytes.True if value was removed.public boolean removex(int part,
int hash,
byte[] keyBytes,
IgniteBiPredicate<Long,Integer> p)
removex in interface GridOffHeapPartitionedMappart - Partition.hash - Hash.keyBytes - Key bytes.p - Value predicate (arguments are value address and value length).True if value was removed.public boolean put(int p,
int hash,
byte[] keyBytes,
byte[] valBytes)
put in interface GridOffHeapPartitionedMapp - Partition.hash - Hash.keyBytes - Key bytes.valBytes - Value bytes.True if new entry was created, false if existing value was updated.public void insert(int p,
int hash,
byte[] keyBytes,
byte[] valBytes)
Use with caution whenever certain that inserting a new value without current mapping.
insert in interface GridOffHeapPartitionedMapp - Partition.hash - Hash.keyBytes - Key bytes.valBytes - Value bytes.public long size()
size in interface GridOffHeapPartitionedMappublic long size(Set<Integer> parts)
size in interface GridOffHeapPartitionedMapparts - Partitions.public long memorySize()
memorySize in interface GridOffHeapPartitionedMappublic long allocatedSize()
allocatedSize in interface GridOffHeapPartitionedMappublic long systemAllocatedSize()
systemAllocatedSize in interface GridOffHeapPartitionedMappublic long freeSize()
freeSize in interface GridOffHeapPartitionedMappublic boolean eventListener(GridOffHeapEventListener evtLsnr)
eventListener in interface GridOffHeapPartitionedMapevtLsnr - Listener.True if event listener was added, false if
another listener already exists.public boolean evictListener(GridOffHeapEvictListener evictLsnr)
evictListener in interface GridOffHeapPartitionedMapevictLsnr - Evict listener.True if evict listener was added, false if
another listener already exists or LRU is disabled.public void destruct()
destruct in interface GridOffHeapPartitionedMappublic GridCloseableIterator<IgniteBiTuple<byte[],byte[]>> iterator()
iterator in interface GridOffHeapPartitionedMappublic <T> GridCloseableIterator<T> iterator(CX2<T2<Long,Integer>,T2<Long,Integer>,T> c)
iterator in interface GridOffHeapPartitionedMapc - Key/value closure.public <T> GridCloseableIterator<T> iterator(CX2<T2<Long,Integer>,T2<Long,Integer>,T> c, int part)
iterator in interface GridOffHeapPartitionedMapc - Key/value closure.part - Partition.public GridCloseableIterator<IgniteBiTuple<byte[],byte[]>> iterator(int p)
iterator in interface GridOffHeapPartitionedMapp - Partition.public short lruStripes()
public long lruMemorySize()
public long lruSize()
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023