Interface PageMemory
- All Known Implementing Classes:
PageMemoryImpl
public interface PageMemory
Page memory accessor.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlongacquirePage(int grpId, int pageId, int tag) Gets the page absolute pointer associated with the given page ID.longacquirePage(int grpId, int pageId, int tag, boolean restore) Gets the page absolute pointer associated with the given page ID.intallocatePage(int grpId, int tag) Allocates a page from the space for the given partition ID and the given flags.voidBegins a checkpoint.voidFinishes a checkpoint.booleanisDirty(int grpId, int pageId, long page) intmetaPageId(int grpId) Gets or allocates metadata page for specified grpId.longreadLock(int grpId, int pageId, long absPtr, int tag, boolean touch) voidreadUnlock(int grpId, int pageId, long absPtr) Releases locked page.voidReduces memory footprint.voidreleasePage(int grpId, int pageId, long absPtr) voidRuns a checkpoint.booleanHeuristic method which allows a thread to check if it safe to start memory struture modifications in regard with checkpointing.voidstart()Start page memory.voidstartStore(int grpId, int metaPageTag, Path path, boolean restorationMode) Starts the store with the specified ID.voidstop()Stop page memory.voidstopStore(int grpId, boolean freePages) Stops the store with the specified ID.longTotal pages can be placed to memory.longtryWriteLock(int grpId, int pageId, long absPtr, int tag) longwriteLock(int grpId, int pageId, long absPtr, int tag) voidwriteUnlock(int grpId, int pageId, long absPtr, boolean modified, int tag)
-
Field Details
-
ANY_TAG
static final int ANY_TAG- See Also:
-
-
Method Details
-
start
Start page memory.- Throws:
IgniteCheckedException
-
stop
Stop page memory. -
startStore
void startStore(int grpId, int metaPageTag, Path path, boolean restorationMode) throws IgniteCheckedException Starts the store with the specified ID.- Parameters:
grpId- Group ID.metaPageTag- Meta-page tag.path- Store path.restorationMode- Flag indicating restoration mode.- Throws:
IgniteCheckedException
-
stopStore
Stops the store with the specified ID.- Parameters:
grpId-freePages-- Throws:
IgniteCheckedException
-
totalPages
long totalPages()Total pages can be placed to memory. -
allocatePage
Allocates a page from the space for the given partition ID and the given flags.- Parameters:
storeId- Group ID.tag- Tag.- Returns:
- page ID within the store.
- Throws:
IgniteCheckedException- If failed.
-
metaPageId
Gets or allocates metadata page for specified grpId.- Parameters:
grpId- Group ID.- Returns:
- Meta page ID for the store.
- Throws:
IgniteCheckedException- If failed.
-
acquirePage
Gets the page absolute pointer associated with the given page ID. Each page obtained with this method must be released by calling#releasePage(int, long, long).An invocation of this method behaves exactly like the invocation
acquirePage(grpId, pageId, false).- Parameters:
grpId- Group ID.pageId- Page ID.tag- Tag.- Returns:
- Page pointer.
- Throws:
IgniteCheckedException- If failed.
-
acquirePage
Gets the page absolute pointer associated with the given page ID. Each page obtained with this method must be released by calling#releasePage(int, long, long).- Parameters:
grpId- Group ID.pageId- Page ID.tag- Tag.restore- Whether the page is acquired for restoration.- Returns:
- Page pointer.
- Throws:
IgniteCheckedException- If failed.
-
releasePage
void releasePage(int grpId, int pageId, long absPtr) - Parameters:
grpId- Group ID.pageId- Page ID to release.absPtr- Page pointer.
-
readLock
long readLock(int grpId, int pageId, long absPtr, int tag, boolean touch) - Parameters:
absPtr- Absolute pointer to read lock.pageId- Page ID.force- Force flag.tag- Tag.touch- Update page timestamp.- Returns:
- Pointer to the page read buffer.
-
readUnlock
void readUnlock(int grpId, int pageId, long absPtr) Releases locked page.- Parameters:
grpId- Cache group ID.pageId- Page ID.absPtr- Page pointer.
-
writeLock
long writeLock(int grpId, int pageId, long absPtr, int tag) - Parameters:
grpId- Group ID.pageId- Page ID.absPtr- Absolute pointer to read lock.tag- Tag.- Returns:
- Pointer to the page read buffer.
-
tryWriteLock
long tryWriteLock(int grpId, int pageId, long absPtr, int tag) - Parameters:
grpId- Group ID.pageId- Page ID.absPtr- Absolute pointer to read lock.tag- Tag.- Returns:
- Pointer to the page read buffer.
-
writeUnlock
void writeUnlock(int grpId, int pageId, long absPtr, boolean modified, int tag) - Parameters:
grpId- Group ID.pageId- Page ID.absPtr- Absolute pointer to read lock.modified- Flag indicating whether the page was modified.tag- Tag.
-
isDirty
boolean isDirty(int grpId, int pageId, long page) - Parameters:
grpId- Cache group ID.pageId- Page ID.page- Page pointer.- Returns:
trueif the page is dirty.
-
beginCheckpoint
void beginCheckpoint()Begins a checkpoint. -
runCheckpoint
Runs a checkpoint.- Parameters:
handle-- Throws:
IgniteCheckedException
-
finishCheckpoint
void finishCheckpoint()Finishes a checkpoint.- Parameters:
handle-
-
safeToUpdate
boolean safeToUpdate()Heuristic method which allows a thread to check if it safe to start memory struture modifications in regard with checkpointing. May return false-negative result during or after partition eviction.- Returns:
Falseif there are too many dirty pages and a thread should wait for a checkpoint to begin.
-
reduceMemoryFootprint
Reduces memory footprint.- Throws:
IgniteCheckedException
-