Interface IgniteCacheOffheapManager
-
- All Known Implementing Classes:
GridCacheOffheapManager,IgniteCacheOffheapManagerImpl
public interface IgniteCacheOffheapManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIgniteCacheOffheapManager.CacheDataStorestatic interfaceIgniteCacheOffheapManager.OffheapInvokeClosure
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Iterable<IgniteCacheOffheapManager.CacheDataStore>cacheDataStores()longcacheEntriesCount(int cacheId)longcacheEntriesCount(int cacheId, boolean primary, boolean backup, AffinityTopologyVersion topVer)longcacheEntriesCount(int cacheId, int part)<K,V>
GridCloseableIterator<javax.cache.Cache.Entry<K,V>>cacheEntriesIterator(GridCacheContext cctx, boolean primary, boolean backup, AffinityTopologyVersion topVer, boolean keepBinary, Boolean dataPageScanEnabled)GridIterator<CacheDataRow>cacheIterator(int cacheId, boolean primary, boolean backup, AffinityTopologyVersion topVer, Boolean dataPageScanEnabled)GridCloseableIterator<KeyCacheObject>cacheKeysIterator(int cacheId, int part)GridIterator<CacheDataRow>cachePartitionIterator(int cacheId, int part, Boolean dataPageScanEnabled)voidclearCache(GridCacheContext cctx, boolean readers)Clears offheap entries.voidconfirmPartitionStatesRestored()Confirm that partition states are restored.booleancontainsKey(GridCacheMapEntry entry)TODO: GG-10884, used on only from initialValue.IgniteCacheOffheapManager.CacheDataStorecreateCacheDataStore(int p)IgniteCacheOffheapManager.CacheDataStoredataStore(@Nullable GridDhtLocalPartition part)voiddestroyCacheDataStore(IgniteCacheOffheapManager.CacheDataStore store)@Nullable RootPagedropRootPageForIndex(int cacheId, String idxName, int segment)Dropping the root page of the index tree.booleanexpire(GridCacheContext cctx, IgniteInClosure2X<GridCacheEntryEx,GridCacheVersion> c, int amount)longexpiredSize()Gets the number of entries pending expire.@Nullable RootPagefindRootPageForIndex(int cacheId, String idxName, int segment)GridAtomicLongglobalRemoveId()booleanhasEntriesPendingExpire(int cacheId)Checks if the cache has entries pending expire.voidinvoke(GridCacheContext cctx, KeyCacheObject key, GridDhtLocalPartition part, IgniteCacheOffheapManager.OffheapInvokeClosure c)longoffHeapAllocatedSize()voidonCacheStarted(GridCacheContext cctx)voidonKernalStop()Callback on node stop.intonUndeploy(ClassLoader ldr)GridIterator<CacheDataRow>partitionIterator(int part)voidpreloadPartition(int pardId)Preload a partition.voidprepareToStop()Prepare cache group to stop (due to cache destroy or cluster deactivate).@Nullable CacheDataRowread(GridCacheContext cctx, KeyCacheObject key)@Nullable CacheDataRowread(GridCacheMapEntry entry)IgniteRebalanceIteratorrebalanceIterator(IgniteDhtDemandedPartitionsMap parts, AffinityTopologyVersion topVer)voidremove(GridCacheContext cctx, KeyCacheObject key, int partId, GridDhtLocalPartition part)@Nullable RootPagerenameRootPageForIndex(int cacheId, String oldIdxName, String newIdxName, int segment)Renaming the root page of the index tree.GridCloseableIterator<CacheDataRow>reservedIterator(int part, AffinityTopologyVersion topVer)voidrestorePartitionStates()Pre-create partitions that resides in page memory or WAL and restores their state.longrestoreStateOfPartition(int p, @Nullable Integer recoveryState)Pre-create single partition that resides in page memory or WAL and restores their state.ReuseListreuseListForIndex(String idxName)RootPagerootPageForIndex(int cacheId, String idxName, int segment)voidstart(GridCacheSharedContext ctx, CacheGroupContext grp)voidstop()Stop cache group (due to cache destroy or cluster deactivate).voidstopCache(int cacheId, boolean destroy)voidstoreEntries(GridDhtLocalPartition part, Iterator<GridCacheEntryInfo> infos, IgnitePredicateX<CacheDataRow> initPred)Store entries.voidupdate(GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, GridDhtLocalPartition part, @Nullable CacheDataRow oldRow)
-
-
-
Method Detail
-
start
void start(GridCacheSharedContext ctx, CacheGroupContext grp) throws IgniteCheckedException
- Parameters:
ctx- Context.grp- Cache group.- Throws:
IgniteCheckedException- If failed.
-
onCacheStarted
void onCacheStarted(GridCacheContext cctx) throws IgniteCheckedException
- Parameters:
cctx- Cache context.- Throws:
IgniteCheckedException- If failed.
-
onKernalStop
void onKernalStop()
Callback on node stop.
-
stopCache
void stopCache(int cacheId, boolean destroy)- Parameters:
cacheId- Cache ID.destroy- Destroy data flag. Setting totruewill remove all cache data.
-
prepareToStop
void prepareToStop()
Prepare cache group to stop (due to cache destroy or cluster deactivate).
-
stop
void stop()
Stop cache group (due to cache destroy or cluster deactivate).
-
restoreStateOfPartition
long restoreStateOfPartition(int p, @Nullable @Nullable Integer recoveryState) throws IgniteCheckedExceptionPre-create single partition that resides in page memory or WAL and restores their state.- Parameters:
p- Partition id.recoveryState- Partition recovery state.- Returns:
- Processing time in millis.
- Throws:
IgniteCheckedException- If failed.
-
restorePartitionStates
void restorePartitionStates() throws IgniteCheckedExceptionPre-create partitions that resides in page memory or WAL and restores their state.- Throws:
IgniteCheckedException- If failed.
-
confirmPartitionStatesRestored
void confirmPartitionStatesRestored()
Confirm that partition states are restored. This method should be called after restoring state of all partitions in group usingrestoreStateOfPartition(int, Integer).
-
read
@Nullable @Nullable CacheDataRow read(GridCacheMapEntry entry) throws IgniteCheckedException
- Parameters:
entry- Cache entry.- Returns:
- Cached row, if available, null otherwise.
- Throws:
IgniteCheckedException- If failed.
-
read
@Nullable @Nullable CacheDataRow read(GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException
- Parameters:
cctx- Cache context.key- Key.- Returns:
- Cached row, if available, null otherwise.
- Throws:
IgniteCheckedException- If failed.
-
createCacheDataStore
IgniteCacheOffheapManager.CacheDataStore createCacheDataStore(int p) throws IgniteCheckedException
- Parameters:
p- Partition.- Returns:
- Data store.
- Throws:
IgniteCheckedException- If failed.
-
cacheDataStores
Iterable<IgniteCacheOffheapManager.CacheDataStore> cacheDataStores()
- Returns:
- Iterable over all existing cache data stores.
-
dataStore
IgniteCacheOffheapManager.CacheDataStore dataStore(@Nullable @Nullable GridDhtLocalPartition part)
- Parameters:
part- Local partition ornullif a related cache group is LOCAL.- Returns:
- Cache data store associated with given partition or the cache data store for a LOCAL cache group.
-
destroyCacheDataStore
void destroyCacheDataStore(IgniteCacheOffheapManager.CacheDataStore store) throws IgniteCheckedException
- Parameters:
store- Data store.- Throws:
IgniteCheckedException- If failed.
-
containsKey
boolean containsKey(GridCacheMapEntry entry)
TODO: GG-10884, used on only from initialValue.
-
expire
boolean expire(GridCacheContext cctx, IgniteInClosure2X<GridCacheEntryEx,GridCacheVersion> c, int amount) throws IgniteCheckedException
- Parameters:
cctx- Cache context.c- Closure.amount- Limit of processed entries by single call,-1for no limit.- Returns:
Trueif unprocessed expired entries remains.- Throws:
IgniteCheckedException- If failed.
-
expiredSize
long expiredSize() throws IgniteCheckedExceptionGets the number of entries pending expire.- Returns:
- Number of pending entries.
- Throws:
IgniteCheckedException- If failed to get number of pending entries.
-
hasEntriesPendingExpire
boolean hasEntriesPendingExpire(int cacheId) throws IgniteCheckedExceptionChecks if the cache has entries pending expire.- Returns:
Trueif there are entries pending expire.- Throws:
IgniteCheckedException- If failed to get number of pending entries.
-
invoke
void invoke(GridCacheContext cctx, KeyCacheObject key, GridDhtLocalPartition part, IgniteCacheOffheapManager.OffheapInvokeClosure c) throws IgniteCheckedException
- Parameters:
cctx- Cache context.key- Key.part- Partition.c- Tree update closure.- Throws:
IgniteCheckedException- If failed.
-
update
void update(GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, GridDhtLocalPartition part, @Nullable @Nullable CacheDataRow oldRow) throws IgniteCheckedException
- Parameters:
cctx- Cache context.key- Key.val- Value.ver- Version.expireTime- Expire time.oldRow- Old row if available.part- Partition.- Throws:
IgniteCheckedException- If failed.
-
remove
void remove(GridCacheContext cctx, KeyCacheObject key, int partId, GridDhtLocalPartition part) throws IgniteCheckedException
- Parameters:
cctx- Cache context.key- Key.partId- Partition number.part- Partition.- Throws:
IgniteCheckedException- If failed.
-
onUndeploy
int onUndeploy(ClassLoader ldr)
- Parameters:
ldr- Class loader.- Returns:
- Number of undeployed entries.
-
cacheIterator
GridIterator<CacheDataRow> cacheIterator(int cacheId, boolean primary, boolean backup, AffinityTopologyVersion topVer, Boolean dataPageScanEnabled) throws IgniteCheckedException
- Parameters:
cacheId- Cache ID.primary- Primary entries flag.backup- Backup entries flag.topVer- Topology version.dataPageScanEnabled- Flag to enable data page scan.- Returns:
- Rows iterator.
- Throws:
IgniteCheckedException- If failed.
-
cachePartitionIterator
GridIterator<CacheDataRow> cachePartitionIterator(int cacheId, int part, Boolean dataPageScanEnabled) throws IgniteCheckedException
- Parameters:
cacheId- Cache ID.part- Partition.dataPageScanEnabled- Flag to enable data page scan.- Returns:
- Partition data iterator.
- Throws:
IgniteCheckedException- If failed.
-
partitionIterator
GridIterator<CacheDataRow> partitionIterator(int part) throws IgniteCheckedException
- Parameters:
part- Partition number.- Returns:
- Iterator for given partition.
- Throws:
IgniteCheckedException- If failed.
-
reservedIterator
GridCloseableIterator<CacheDataRow> reservedIterator(int part, AffinityTopologyVersion topVer) throws IgniteCheckedException
- Parameters:
part- Partition number.topVer- Topology version.- Returns:
- Iterator for given partition that will reserve partition state until it is closed.
- Throws:
IgniteCheckedException- If failed.
-
rebalanceIterator
IgniteRebalanceIterator rebalanceIterator(IgniteDhtDemandedPartitionsMap parts, AffinityTopologyVersion topVer) throws IgniteCheckedException
- Parameters:
parts- Partitions.- Returns:
- Partition data iterator.
- Throws:
IgniteCheckedException- If failed.
-
cacheEntriesIterator
<K,V> GridCloseableIterator<javax.cache.Cache.Entry<K,V>> cacheEntriesIterator(GridCacheContext cctx, boolean primary, boolean backup, AffinityTopologyVersion topVer, boolean keepBinary, Boolean dataPageScanEnabled) throws IgniteCheckedException
- Parameters:
cctx- Cache context.primary-Trueif need to return primary entries.backup-Trueif need to return backup entries.topVer- Topology version.keepBinary- Keep binary flag.dataPageScanEnabled- Flag to enable data page scan.- Returns:
- Entries iterator.
- Throws:
IgniteCheckedException- If failed.
-
cacheKeysIterator
GridCloseableIterator<KeyCacheObject> cacheKeysIterator(int cacheId, int part) throws IgniteCheckedException
- Parameters:
cacheId- Cache ID.part- Partition.- Returns:
- Iterator.
- Throws:
IgniteCheckedException- If failed.
-
cacheEntriesCount
long cacheEntriesCount(int cacheId, boolean primary, boolean backup, AffinityTopologyVersion topVer)- Parameters:
cacheId- Cache ID.primary- Primary entries flag.backup- Backup entries flag.topVer- Topology version.- Returns:
- Entries count.
-
storeEntries
void storeEntries(GridDhtLocalPartition part, Iterator<GridCacheEntryInfo> infos, IgnitePredicateX<CacheDataRow> initPred) throws IgniteCheckedException
Store entries.- Parameters:
part- Local partition.infos- Entry infos.initPred- Applied to all created rows. Each row that not matches the predicate is removed.- Throws:
IgniteCheckedException- If failed.
-
clearCache
void clearCache(GridCacheContext cctx, boolean readers)
Clears offheap entries.- Parameters:
cctx- Cache context.readers-Trueto clear readers.
-
cacheEntriesCount
long cacheEntriesCount(int cacheId, int part)- Parameters:
cacheId- Cache ID.part- Partition.- Returns:
- Number of entries in given partition.
-
offHeapAllocatedSize
long offHeapAllocatedSize()
- Returns:
- Offheap allocated size.
-
globalRemoveId
GridAtomicLong globalRemoveId()
- Returns:
- Global remove ID counter.
-
rootPageForIndex
RootPage rootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException
- Parameters:
cacheId- Cache ID.idxName- Index name.segment- Segment.- Returns:
- Root page for index tree.
- Throws:
IgniteCheckedException- If failed.
-
findRootPageForIndex
@Nullable @Nullable RootPage findRootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException
- Parameters:
cacheId- Cache ID.idxName- Index name.- Throws:
IgniteCheckedException- If failed.
-
dropRootPageForIndex
@Nullable @Nullable RootPage dropRootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException
Dropping the root page of the index tree.- Parameters:
cacheId- Cache ID.idxName- Index name.segment- Segment index.- Returns:
- Dropped root page of the index tree.
- Throws:
IgniteCheckedException- If failed.
-
renameRootPageForIndex
@Nullable @Nullable RootPage renameRootPageForIndex(int cacheId, String oldIdxName, String newIdxName, int segment) throws IgniteCheckedException
Renaming the root page of the index tree.- Parameters:
cacheId- Cache id.oldIdxName- Old name of the index tree.newIdxName- New name of the index tree.segment- Segment index.- Returns:
- Renamed root page of the index tree.
- Throws:
IgniteCheckedException- If failed.
-
reuseListForIndex
ReuseList reuseListForIndex(String idxName) throws IgniteCheckedException
- Parameters:
idxName- Index name.- Returns:
- Reuse list for index tree.
- Throws:
IgniteCheckedException- If failed.
-
cacheEntriesCount
long cacheEntriesCount(int cacheId)
- Parameters:
cacheId- Cache ID.- Returns:
- Number of entries.
-
preloadPartition
void preloadPartition(int pardId) throws IgniteCheckedExceptionPreload a partition. Must be called under partition reservation for DHT caches.- Parameters:
pardId- Partition id.- Throws:
IgniteCheckedException- If failed.
-
-