Interface IgnitePageStoreManager
-
- All Superinterfaces:
GridCacheSharedManager,IgniteChangeGlobalStateSupport,PageReadWriteManager
- All Known Implementing Classes:
FilePageStoreManager
public interface IgnitePageStoreManager extends GridCacheSharedManager, IgniteChangeGlobalStateSupport, PageReadWriteManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longallocatePage(int grpId, int partId, byte flags)Allocates a page for the given page space.voidbeginRecover()Invoked before starting checkpoint recover.voidcleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred, boolean cleanFiles)Cleanup cache store whether it matches the provided predicate and if matched store was previously initizlized.voidcleanupPersistentSpace()Cleanup persistent space for all caches except metastore.voidcleanupPersistentSpace(CacheConfiguration cacheConfiguration)Cleanup persistent space for cache.voidensure(int grpId, int partId)booleanexists(int grpId, int partId)Checks if partition store exists.voidfinishRecover()Invoked after checkpoint recover is finished.booleanhasIndexStore(int grpId)voidinitializeForCache(CacheGroupDescriptor grpDesc, CacheConfiguration<?,?> ccfg)Callback called when a cache is starting.voidinitializeForMetastorage()Initializes disk cache store structures.longpageOffset(int grpId, long pageId)Gets page offset within the page store file.intpages(int grpId, int partId)Gets total number of allocated pages for the given space.longpagesAllocated(int grpId)Calculates number of pages currently allocated for given cache group.voidreadHeader(int grpId, int partId, ByteBuffer buf)Reads a header of a page store.voidshutdownForCacheGroup(CacheGroupContext grp, boolean destroy)Callback called when a cache is stopping.voidsync(int grpId, int partId)Makes sure that all previous writes to the store has been written to disk.voidtruncate(int grpId, int partId, int tag)Callback called when a partition for the given cache is evicted from the local node.PageStorewrite(int grpId, long pageId, ByteBuffer pageBuf, int tag, boolean calculateCrc)Writes the page for the given cache ID.-
Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheSharedManager
onDisconnected, onKernalStart, onKernalStop, onReconnected, printMemoryStats, start, stop
-
Methods inherited from interface org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport
onActivate, onDeActivate
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.persistence.pagemem.PageReadWriteManager
read
-
-
-
-
Method Detail
-
beginRecover
void beginRecover()
Invoked before starting checkpoint recover.
-
finishRecover
void finishRecover() throws IgniteCheckedExceptionInvoked after checkpoint recover is finished.- Throws:
IgniteCheckedException
-
initializeForCache
void initializeForCache(CacheGroupDescriptor grpDesc, CacheConfiguration<?,?> ccfg) throws IgniteCheckedException
Callback called when a cache is starting.- Parameters:
grpDesc- Cache group descriptor.ccfg- Cache configuration.- Throws:
IgniteCheckedException- If failed to handle cache start callback.
-
initializeForMetastorage
void initializeForMetastorage() throws IgniteCheckedExceptionInitializes disk cache store structures.- Throws:
IgniteCheckedException
-
shutdownForCacheGroup
void shutdownForCacheGroup(CacheGroupContext grp, boolean destroy) throws IgniteCheckedException
Callback called when a cache is stopping. After this callback is invoked, no data associated with the given cache will be stored on disk.- Parameters:
grp- Cache group being stopped.destroy- Flag indicating if the cache is being destroyed and data should be cleaned.- Throws:
IgniteCheckedException- If failed to handle cache destroy callback.
-
truncate
void truncate(int grpId, int partId, int tag) throws IgniteCheckedExceptionCallback called when a partition for the given cache is evicted from the local node. After this callback is invoked, no data associated with the partition will be stored on disk.- Parameters:
grpId- Cache group ID of the evicted partition.partId- Partition ID.tag- Partition tag (growing 1-based partition file version).- Throws:
IgniteCheckedException- If failed to handle partition destroy callback.
-
exists
boolean exists(int grpId, int partId) throws IgniteCheckedExceptionChecks if partition store exists.- Parameters:
grpId- Cache group ID.partId- Partition ID.- Returns:
Trueif partition store exists.- Throws:
IgniteCheckedException- If failed.
-
readHeader
void readHeader(int grpId, int partId, ByteBuffer buf) throws IgniteCheckedExceptionReads a header of a page store.- Parameters:
grpId- Cache group ID.partId- Partition ID.buf- Buffer to write to.- Throws:
IgniteCheckedException- If failed.
-
write
PageStore write(int grpId, long pageId, ByteBuffer pageBuf, int tag, boolean calculateCrc) throws IgniteCheckedException
Writes the page for the given cache ID. Cache ID may be0if the page is a meta page.- Specified by:
writein interfacePageReadWriteManager- Parameters:
grpId- Cache group ID.pageId- Page ID.pageBuf- Page buffer to write.- Throws:
IgniteCheckedException- If failed to write page.
-
pageOffset
long pageOffset(int grpId, long pageId) throws IgniteCheckedExceptionGets page offset within the page store file.- Parameters:
grpId- Cache group ID.pageId- Page ID.- Returns:
- Page offset.
- Throws:
IgniteCheckedException- If failed.
-
sync
void sync(int grpId, int partId) throws IgniteCheckedExceptionMakes sure that all previous writes to the store has been written to disk.- Parameters:
grpId- Cache group ID to sync.partId- Partition ID to sync.- Throws:
IgniteCheckedException- If IO error occurred while running sync.
-
ensure
void ensure(int grpId, int partId) throws IgniteCheckedException- Parameters:
grpId- Cache group ID.partId- Partition ID.- Throws:
IgniteCheckedException- If failed.
-
allocatePage
long allocatePage(int grpId, int partId, byte flags) throws IgniteCheckedExceptionAllocates a page for the given page space.- Specified by:
allocatePagein interfacePageReadWriteManager- Parameters:
grpId- Cache group ID.partId- Partition ID. Used only ifflagsis not equal toPageIdAllocator.FLAG_IDX.flags- Page allocation flags.- Returns:
- Allocated page ID.
- Throws:
IgniteCheckedException- If IO exception occurred while allocating a page ID.
-
pages
int pages(int grpId, int partId) throws IgniteCheckedExceptionGets total number of allocated pages for the given space.- Parameters:
grpId- Cache group ID.partId- Partition ID.- Returns:
- Number of allocated pages.
- Throws:
IgniteCheckedException- If failed.
-
hasIndexStore
boolean hasIndexStore(int grpId)
- Parameters:
grpId- Cache group ID.- Returns:
Trueif index store for given cache group existed before node started.
-
pagesAllocated
long pagesAllocated(int grpId)
Calculates number of pages currently allocated for given cache group.- Parameters:
grpId- cache group id.- Returns:
- number of pages.
-
cleanupPersistentSpace
void cleanupPersistentSpace(CacheConfiguration cacheConfiguration) throws IgniteCheckedException
Cleanup persistent space for cache.- Parameters:
cacheConfiguration- Cache configuration of cache which should be cleanup.- Throws:
IgniteCheckedException
-
cleanupPersistentSpace
void cleanupPersistentSpace() throws IgniteCheckedExceptionCleanup persistent space for all caches except metastore.- Throws:
IgniteCheckedException
-
cleanupPageStoreIfMatch
void cleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred, boolean cleanFiles)
Cleanup cache store whether it matches the provided predicate and if matched store was previously initizlized.- Parameters:
cacheGrpPred- Predicate to match by id cache group stores to clean.cleanFiles-Trueto delete all persisted files related to particular store.
-
-