Interface GridOffHeapMap
-
- All Known Implementing Classes:
GridUnsafeMap
public interface GridOffHeapMapOff-heap map.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longallocatedSize()Gets memory allocated for map entries so far.intconcurrency()Gets concurrency level for this map.booleancontains(int hash, byte[] keyBytes)Checks if given key is contained in the map.voiddestruct()Destructs this map and deallocates all memory.voidenableEviction(int hash, byte[] keyBytes)Enables eviction for given key.booleaneventListener(GridOffHeapEventListener lsnr)Adds off-heap event listener.booleanevictListener(GridOffHeapEvictListener lsnr)Sets callback for when entries are evicted due to memory constraints.longfreeSize()Gets available memory.@org.jetbrains.annotations.Nullable byte[]get(int hash, byte[] keyBytes)Gets value bytes for given key.voidinsert(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(@Nullable CX2<T2<Long,Integer>,T2<Long,Integer>,T> c)Gets iterator over map.floatloadFactor()Gets load factor of this map.longmemorySize()Gets total available memory size.intpartition()Gets partition this map belongs to.booleanput(int hash, byte[] keyBytes, byte[] valBytes)Puts key and value bytes into the map potentially replacing existing entry.@org.jetbrains.annotations.Nullable byte[]remove(int hash, byte[] keyBytes)Removes value from off-heap map.booleanremovex(int hash, byte[] keyBytes)Removes value from off-heap map without returning it.booleanremovex(int hash, byte[] keyBytes, IgniteBiPredicate<Long,Integer> p)Removes value from off-heap map without returning it.longsize()Gets number of elements in the map.longsystemAllocatedSize()Gets memory allocated for map internal structure so far.longtotalSize()Gets number of elements in the map.@Nullable IgniteBiTuple<Long,Integer>valuePointer(int hash, byte[] keyBytes)Gets value pointer for given key.
-
-
-
Method Detail
-
partition
int partition()
Gets partition this map belongs to.- Returns:
- Partition this map belongs to.
-
loadFactor
float loadFactor()
Gets load factor of this map.- Returns:
- Load factor.
-
concurrency
int concurrency()
Gets concurrency level for this map.- Returns:
- Concurrency level.
-
contains
boolean contains(int hash, byte[] keyBytes)Checks if given key is contained in the map.- Parameters:
hash- Hash.keyBytes- Key bytes.- Returns:
Trueif key is contained in the map.
-
get
@Nullable @org.jetbrains.annotations.Nullable byte[] get(int hash, byte[] keyBytes)Gets value bytes for given key.- Parameters:
hash- Hash.keyBytes- Key bytes.- Returns:
- Value bytes.
-
valuePointer
@Nullable @Nullable IgniteBiTuple<Long,Integer> valuePointer(int hash, byte[] keyBytes)
Gets value pointer for given key.- Parameters:
hash- Hash.keyBytes- Key bytes.- Returns:
- Value pointer.
-
enableEviction
void enableEviction(int hash, byte[] keyBytes)Enables eviction for given key.- Parameters:
hash- Hash.keyBytes- Key bytes.
-
remove
@Nullable @org.jetbrains.annotations.Nullable byte[] remove(int hash, byte[] keyBytes)Removes value from off-heap map.- Parameters:
hash- Hash.keyBytes- Key bytes.- Returns:
- Removed value bytes.
-
removex
boolean removex(int hash, byte[] keyBytes)Removes value from off-heap map without returning it.- Parameters:
hash- Hash.keyBytes- Key bytes.- Returns:
Trueif value was removed.
-
removex
boolean removex(int hash, byte[] keyBytes, IgniteBiPredicate<Long,Integer> p)Removes value from off-heap map without returning it.- Parameters:
hash- Hash.keyBytes- Key bytes.p- Value predicate (arguments are value address and value length).- Returns:
Trueif value was removed.
-
put
boolean put(int hash, byte[] keyBytes, byte[] valBytes)Puts key and value bytes into the map potentially replacing existing entry.- Parameters:
hash- Hash.keyBytes- Key bytes.valBytes- Value bytes.- Returns:
Trueif new entry was created,falseif existing value was updated.
-
insert
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.Use with caution whenever certain that inserting a new value without current mapping.
- Parameters:
hash- Hash.keyBytes- Key bytes.valBytes- Value bytes.
-
totalSize
long totalSize()
Gets number of elements in the map.- Returns:
- Number of elements in the map.
-
size
long size()
Gets number of elements in the map.- Returns:
- Number of elements in the map.
-
memorySize
long memorySize()
Gets total available memory size.- Returns:
- Memory size.
-
allocatedSize
long allocatedSize()
Gets memory allocated for map entries so far.- Returns:
- Allocated memory.
-
systemAllocatedSize
long systemAllocatedSize()
Gets memory allocated for map internal structure so far.- Returns:
- Allocated memory.
-
freeSize
long freeSize()
Gets available memory.- Returns:
- Available memory.
-
destruct
void destruct()
Destructs this map and deallocates all memory.
-
iterator
GridCloseableIterator<IgniteBiTuple<byte[],byte[]>> iterator()
Gets iterator over map.- Returns:
- Iterator over map.
-
iterator
<T> GridCloseableIterator<T> iterator(@Nullable @Nullable CX2<T2<Long,Integer>,T2<Long,Integer>,T> c)
Gets iterator over map.- Parameters:
c- Key/value closure.- Returns:
- Iterator over map.
-
evictListener
boolean evictListener(GridOffHeapEvictListener lsnr)
Sets callback for when entries are evicted due to memory constraints. The parameter into closure is key bytes.- Parameters:
lsnr- Evict listener.- Returns:
Trueif evict listener was added,falseif another listener already exists orLRUis disabled.
-
eventListener
boolean eventListener(GridOffHeapEventListener lsnr)
Adds off-heap event listener.- Parameters:
lsnr- Listener.- Returns:
Trueif event listener was added,falseif another listener already exists.
-
-