Class IgniteCacheOffheapManagerImpl.CacheDataStoreImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl.CacheDataStoreImpl
-
- All Implemented Interfaces:
IgniteCacheOffheapManager.CacheDataStore
- Enclosing class:
- IgniteCacheOffheapManagerImpl
public static class IgniteCacheOffheapManagerImpl.CacheDataStoreImpl extends Object implements IgniteCacheOffheapManager.CacheDataStore
-
-
Field Summary
Fields Modifier and Type Field Description protected PartitionUpdateCounterpCntrUpdate counter.
-
Constructor Summary
Constructors Constructor Description CacheDataStoreImpl(int partId, CacheDataRowStore rowStore, CacheDataTree dataTree, Supplier<PendingEntriesTree> pendingEntries, CacheGroupContext grp, GridSpinBusyLock busyLock, IgniteLogger log, @Nullable Supplier<GridQueryRowCacheCleaner> cleaner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcacheSize(int cacheId)Map<Integer,Long>cacheSizes()voidclear(int cacheId)Clears all the records associated with logical cache with given ID.CacheDataRowcreateRow(GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, @Nullable CacheDataRow oldRow)GridCursor<? extends CacheDataRow>cursor()GridCursor<? extends CacheDataRow>cursor(int cacheId)GridCursor<? extends CacheDataRow>cursor(int cacheId, KeyCacheObject lower, KeyCacheObject upper)GridCursor<? extends CacheDataRow>cursor(int cacheId, KeyCacheObject lower, KeyCacheObject upper, Object x)GridCursor<? extends CacheDataRow>cursor(Object x)voiddestroy()Destroys the tree associated with the store.booleandestroyed()GridLongListfinalizeUpdateCounters()Flushes pending update counters closing all possible gaps.CacheDataRowfind(GridCacheContext cctx, KeyCacheObject key)longfullSize()longgetAndIncrementUpdateCounter(long delta)Returns current value and updates counter by delta.longhighestAppliedCounter()booleaninit()Initialize data store if it exists.longinitialUpdateCounter()voidinsertRows(Collection<DataRowCacheAware> rows, IgnitePredicateX<CacheDataRow> initPred)Insert rows into page memory.voidinvoke(GridCacheContext cctx, KeyCacheObject key, IgniteCacheOffheapManager.OffheapInvokeClosure c)booleanisEmpty()voidmarkDestroyed()Mark store as destroyed.longnextUpdateCounter()intpartId()PartitionMetaStorage<SimpleDataRow>partStorage()Partition storage.PartitionUpdateCounterpartUpdateCounter()PendingEntriesTreependingTree()Return PendingTree for data store.voidpreload()Preload a store into page memory.voidremove(GridCacheContext cctx, KeyCacheObject key, int partId)longreserve(long delta)longreservedCounter()voidresetInitialUpdateCounter()Reset the initial value of the partition counter.voidresetUpdateCounter()Reset counter for partition.voidrestoreState(long size, long updCntr, @Nullable Map<Integer,Long> cacheSizes, byte[] cntrUpdData)RowStorerowStore()voidsetRowCacheCleaner(GridQueryRowCacheCleaner rowCacheCleaner)Inject rows cache cleaner.CacheDataTreetree()voidupdate(GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, @Nullable CacheDataRow oldRow)longupdateCounter()voidupdateCounter(long val)booleanupdateCounter(long start, long delta)Updates counters from start value by delta value.voidupdateInitialCounter(long start, long delta)voidupdateSize(int cacheId, long delta)Updates size metric for particular cache.
-
-
-
Field Detail
-
pCntr
protected final PartitionUpdateCounter pCntr
Update counter.
-
-
Constructor Detail
-
CacheDataStoreImpl
public CacheDataStoreImpl(int partId, CacheDataRowStore rowStore, CacheDataTree dataTree, Supplier<PendingEntriesTree> pendingEntries, CacheGroupContext grp, GridSpinBusyLock busyLock, IgniteLogger log, @Nullable @Nullable Supplier<GridQueryRowCacheCleaner> cleaner)- Parameters:
partId- Partition number.rowStore- Row store.dataTree- Data tree.
-
-
Method Detail
-
tree
public CacheDataTree tree()
- Specified by:
treein interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Cache data tree object.
-
init
public boolean init()
Initialize data store if it exists.- Specified by:
initin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
Trueif initialized.
-
partId
public int partId()
- Specified by:
partIdin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Partition ID.
-
cacheSize
public long cacheSize(int cacheId)
- Specified by:
cacheSizein interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cacheId- Cache ID.- Returns:
- Size.
-
cacheSizes
public Map<Integer,Long> cacheSizes()
- Specified by:
cacheSizesin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Cache sizes if store belongs to group containing multiple caches.
-
fullSize
public long fullSize()
- Specified by:
fullSizein interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Total size.
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
Trueif there are no items in the store.
-
updateSize
public void updateSize(int cacheId, long delta)Updates size metric for particular cache.- Specified by:
updateSizein interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cacheId- Cache ID.delta- Size delta.
-
nextUpdateCounter
public long nextUpdateCounter()
- Specified by:
nextUpdateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Next update counter.
-
initialUpdateCounter
public long initialUpdateCounter()
- Specified by:
initialUpdateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Initial update counter.
-
updateInitialCounter
public void updateInitialCounter(long start, long delta)- Specified by:
updateInitialCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
start- Start.delta- Delta.
-
getAndIncrementUpdateCounter
public long getAndIncrementUpdateCounter(long delta)
Returns current value and updates counter by delta.- Specified by:
getAndIncrementUpdateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
delta- Delta.- Returns:
- Current value.
-
updateCounter
public long updateCounter()
- Specified by:
updateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Update counter (LWM).
-
highestAppliedCounter
public long highestAppliedCounter()
- Specified by:
highestAppliedCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Highest applied update counter.
-
reservedCounter
public long reservedCounter()
- Specified by:
reservedCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Reserved counter (HWM).
-
partUpdateCounter
public PartitionUpdateCounter partUpdateCounter()
- Specified by:
partUpdateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Update counter or
nullif store is not yet created.
-
reserve
public long reserve(long delta)
- Specified by:
reservein interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
delta- Delta.
-
updateCounter
public void updateCounter(long val)
- Specified by:
updateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
val- Update counter.
-
updateCounter
public boolean updateCounter(long start, long delta)Updates counters from start value by delta value.- Specified by:
updateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
start- Start.delta- Delta.
-
finalizeUpdateCounters
public GridLongList finalizeUpdateCounters()
Flushes pending update counters closing all possible gaps.- Specified by:
finalizeUpdateCountersin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Even-length array of pairs [start, end] for each gap.
-
invoke
public void invoke(GridCacheContext cctx, KeyCacheObject key, IgniteCacheOffheapManager.OffheapInvokeClosure c) throws IgniteCheckedException
- Specified by:
invokein interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cctx- Cache context.key- Key.c- Closure.- Throws:
IgniteCheckedException- If failed.
-
createRow
public CacheDataRow createRow(GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, @Nullable @Nullable CacheDataRow oldRow) throws IgniteCheckedException
- Specified by:
createRowin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cctx- Cache context.key- Key.val- Value.ver- Version.expireTime- Expire time.oldRow- Old row.- Returns:
- New row.
- Throws:
IgniteCheckedException- If failed.
-
insertRows
public void insertRows(Collection<DataRowCacheAware> rows, IgnitePredicateX<CacheDataRow> initPred) throws IgniteCheckedException
Insert rows into page memory.- Specified by:
insertRowsin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
rows- Rows.initPred- Applied to all rows. Each row that not matches the predicate is removed.- Throws:
IgniteCheckedException- If failed.
-
update
public void update(GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, @Nullable @Nullable CacheDataRow oldRow) throws IgniteCheckedException
- Specified by:
updatein interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cctx- Cache context.key- Key.val- Value.ver- Version.expireTime- Expire time.oldRow- Old row if available.- Throws:
IgniteCheckedException- If failed.
-
remove
public void remove(GridCacheContext cctx, KeyCacheObject key, int partId) throws IgniteCheckedException
- Specified by:
removein interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cctx- Cache context.key- Key.partId- Partition number.- Throws:
IgniteCheckedException- If failed.
-
find
public CacheDataRow find(GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException
- Specified by:
findin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cctx- Cache context.key- Key.- Returns:
- Data row.
- Throws:
IgniteCheckedException- If failed.
-
cursor
public GridCursor<? extends CacheDataRow> cursor() throws IgniteCheckedException
- Specified by:
cursorin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Data cursor.
- Throws:
IgniteCheckedException- If failed.
-
cursor
public GridCursor<? extends CacheDataRow> cursor(Object x) throws IgniteCheckedException
- Specified by:
cursorin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
x- Implementation specific argument,nullalways means that we need to return full detached data row.- Returns:
- Data cursor.
- Throws:
IgniteCheckedException- If failed.
-
cursor
public GridCursor<? extends CacheDataRow> cursor(int cacheId) throws IgniteCheckedException
- Specified by:
cursorin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cacheId- Cache ID.- Returns:
- Data cursor.
- Throws:
IgniteCheckedException- If failed.
-
cursor
public GridCursor<? extends CacheDataRow> cursor(int cacheId, KeyCacheObject lower, KeyCacheObject upper) throws IgniteCheckedException
- Specified by:
cursorin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cacheId- Cache ID.lower- Lower bound.upper- Upper bound.- Returns:
- Data cursor.
- Throws:
IgniteCheckedException- If failed.
-
cursor
public GridCursor<? extends CacheDataRow> cursor(int cacheId, KeyCacheObject lower, KeyCacheObject upper, Object x) throws IgniteCheckedException
- Specified by:
cursorin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cacheId- Cache ID.lower- Lower bound.upper- Upper bound.x- Implementation specific argument,nullalways means that we need to return full detached data row.- Returns:
- Data cursor.
- Throws:
IgniteCheckedException- If failed.
-
destroy
public void destroy() throws IgniteCheckedExceptionDestroys the tree associated with the store.- Specified by:
destroyin interfaceIgniteCacheOffheapManager.CacheDataStore- Throws:
IgniteCheckedException- If failed.
-
markDestroyed
public void markDestroyed()
Mark store as destroyed.- Specified by:
markDestroyedin interfaceIgniteCacheOffheapManager.CacheDataStore
-
destroyed
public boolean destroyed()
- Specified by:
destroyedin interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
trueIf marked as destroyed.
-
clear
public void clear(int cacheId) throws IgniteCheckedExceptionClears all the records associated with logical cache with given ID.- Specified by:
clearin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
cacheId- Cache ID.- Throws:
IgniteCheckedException- If failed.
-
rowStore
public RowStore rowStore()
- Specified by:
rowStorein interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- Row store.
-
setRowCacheCleaner
public void setRowCacheCleaner(GridQueryRowCacheCleaner rowCacheCleaner)
Inject rows cache cleaner.- Specified by:
setRowCacheCleanerin interfaceIgniteCacheOffheapManager.CacheDataStore- Parameters:
rowCacheCleaner- Rows cache cleaner.
-
restoreState
public void restoreState(long size, long updCntr, @Nullable @Nullable Map<Integer,Long> cacheSizes, byte[] cntrUpdData)- Parameters:
size- Size to init.updCntr- Update counter.cacheSizes- Cache sizes if store belongs to group containing multiple caches.cntrUpdData- Counter updates.
-
pendingTree
public PendingEntriesTree pendingTree()
Return PendingTree for data store.- Specified by:
pendingTreein interfaceIgniteCacheOffheapManager.CacheDataStore- Returns:
- PendingTree instance.
-
preload
public void preload() throws IgniteCheckedExceptionPreload a store into page memory.- Specified by:
preloadin interfaceIgniteCacheOffheapManager.CacheDataStore- Throws:
IgniteCheckedException- If failed.
-
resetUpdateCounter
public void resetUpdateCounter()
Reset counter for partition.- Specified by:
resetUpdateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore
-
resetInitialUpdateCounter
public void resetInitialUpdateCounter()
Reset the initial value of the partition counter.- Specified by:
resetInitialUpdateCounterin interfaceIgniteCacheOffheapManager.CacheDataStore
-
partStorage
public PartitionMetaStorage<SimpleDataRow> partStorage()
Partition storage.- Specified by:
partStoragein interfaceIgniteCacheOffheapManager.CacheDataStore
-
-