public abstract class DataStructure extends Object implements PageLockListener
PageMemory
.Modifier and Type | Field and Description |
---|---|
protected int |
cacheId |
protected PageMemory |
pageMem |
protected ReuseList |
reuseList |
static Random |
rnd
For tests.
|
protected IgniteWriteAheadLogManager |
wal |
Constructor and Description |
---|
DataStructure(int cacheId,
PageMemory pageMem,
IgniteWriteAheadLogManager wal) |
Modifier and Type | Method and Description |
---|---|
protected long |
acquirePage(long pageId) |
protected long |
allocatePage(ReuseBag bag) |
protected long |
allocatePageNoReuse() |
int |
getCacheId() |
protected void |
init(long pageId,
PageIO init) |
protected boolean |
needWalDeltaRecord(long pageId,
long page,
Boolean walPlc) |
void |
onBeforeReadLock(int cacheId,
long pageId,
long page) |
void |
onBeforeWriteLock(int cacheId,
long pageId,
long page) |
void |
onReadLock(int cacheId,
long pageId,
long page,
long pageAddr) |
void |
onReadUnlock(int cacheId,
long pageId,
long page,
long pageAddr) |
void |
onWriteLock(int cacheId,
long pageId,
long page,
long pageAddr) |
void |
onWriteUnlock(int cacheId,
long pageId,
long page,
long pageAddr) |
protected int |
pageSize() |
static int |
randomInt(int max) |
protected <X,R> R |
read(long pageId,
long page,
PageHandler<X,R> h,
X arg,
int intArg,
R lockFailed) |
protected <X,R> R |
read(long pageId,
PageHandler<X,R> h,
X arg,
int intArg,
R lockFailed) |
protected long |
readLock(long pageId,
long page) |
protected void |
readUnlock(long pageId,
long page,
long pageAddr) |
protected long |
recyclePage(long pageId,
long page,
long pageAddr,
Boolean walPlc) |
protected void |
releasePage(long pageId,
long page) |
protected long |
tryWriteLock(long pageId,
long page) |
protected <X,R> R |
write(long pageId,
long page,
PageHandler<X,R> h,
X arg,
int intArg,
R lockFailed) |
protected <R> R |
write(long pageId,
PageHandler<?,R> h,
int intArg,
R lockFailed) |
protected <X,R> R |
write(long pageId,
PageHandler<X,R> h,
PageIO init,
X arg,
int intArg,
R lockFailed) |
protected <X,R> R |
write(long pageId,
PageHandler<X,R> h,
X arg,
int intArg,
R lockFailed) |
protected long |
writeLock(long pageId,
long page) |
protected void |
writeUnlock(long pageId,
long page,
long pageAddr,
boolean dirty)
Note: Default WAL record policy will be used.
|
protected void |
writeUnlock(long pageId,
long page,
long pageAddr,
Boolean walPlc,
boolean dirty) |
public static Random rnd
protected final int cacheId
protected final PageMemory pageMem
protected final IgniteWriteAheadLogManager wal
protected ReuseList reuseList
public DataStructure(int cacheId, PageMemory pageMem, IgniteWriteAheadLogManager wal)
cacheId
- Cache ID.pageMem
- Page memory.wal
- Write ahead log manager.public final int getCacheId()
public static int randomInt(int max)
max
- Max.0
(inclusive) to the given max value (exclusive).protected final long allocatePage(ReuseBag bag) throws IgniteCheckedException
bag
- Reuse bag.IgniteCheckedException
- If failed.protected long allocatePageNoReuse() throws IgniteCheckedException
IgniteCheckedException
- If failed.protected final long acquirePage(long pageId) throws IgniteCheckedException
pageId
- Page ID.IgniteCheckedException
- If failed.protected final void releasePage(long pageId, long page)
pageId
- Page ID.page
- Page pointer.protected final long tryWriteLock(long pageId, long page)
pageId
- Page IDpage
- Page pointer.0
if failed to lock due to recycling.protected final long writeLock(long pageId, long page)
pageId
- Page IDpage
- Page pointer.protected final void writeUnlock(long pageId, long page, long pageAddr, boolean dirty)
Note: Default WAL record policy will be used.
pageId
- Page IDpage
- Page pointer.pageAddr
- Page address.dirty
- Dirty flag.protected final long readLock(long pageId, long page)
pageId
- Page IDpage
- Page pointer.protected final void readUnlock(long pageId, long page, long pageAddr)
pageId
- Page IDpage
- Page pointer.pageAddr
- Page address.protected final void writeUnlock(long pageId, long page, long pageAddr, Boolean walPlc, boolean dirty)
pageId
- Page IDpage
- Page pointer.pageAddr
- Page address.walPlc
- Full page WAL record policy.dirty
- Dirty flag.protected final boolean needWalDeltaRecord(long pageId, long page, Boolean walPlc)
pageId
- Page ID.page
- Page pointer.walPlc
- Full page WAL record policy.true
If we need to make a delta WAL record for the change in this page.protected final <R> R write(long pageId, PageHandler<?,R> h, int intArg, R lockFailed) throws IgniteCheckedException
pageId
- Page ID.h
- Handler.intArg
- Argument of type int
.lockFailed
- Result in case of lock failure due to page recycling.IgniteCheckedException
- If failed.protected final <X,R> R write(long pageId, PageHandler<X,R> h, X arg, int intArg, R lockFailed) throws IgniteCheckedException
pageId
- Page ID.h
- Handler.arg
- Argument.intArg
- Argument of type int
.lockFailed
- Result in case of lock failure due to page recycling.IgniteCheckedException
- If failed.protected final <X,R> R write(long pageId, long page, PageHandler<X,R> h, X arg, int intArg, R lockFailed) throws IgniteCheckedException
pageId
- Page ID.page
- Page pointer.h
- Handler.arg
- Argument.intArg
- Argument of type int
.lockFailed
- Result in case of lock failure due to page recycling.IgniteCheckedException
- If failed.protected final <X,R> R write(long pageId, PageHandler<X,R> h, PageIO init, X arg, int intArg, R lockFailed) throws IgniteCheckedException
pageId
- Page ID.h
- Handler.init
- IO for new page initialization or null
if it is an existing page.arg
- Argument.intArg
- Argument of type int
.lockFailed
- Result in case of lock failure due to page recycling.IgniteCheckedException
- If failed.protected final <X,R> R read(long pageId, PageHandler<X,R> h, X arg, int intArg, R lockFailed) throws IgniteCheckedException
pageId
- Page ID.h
- Handler.arg
- Argument.intArg
- Argument of type int
.lockFailed
- Result in case of lock failure due to page recycling.IgniteCheckedException
- If failed.protected final <X,R> R read(long pageId, long page, PageHandler<X,R> h, X arg, int intArg, R lockFailed) throws IgniteCheckedException
pageId
- Page ID.page
- Page pointer.h
- Handler.arg
- Argument.intArg
- Argument of type int
.lockFailed
- Result in case of lock failure due to page recycling.IgniteCheckedException
- If failed.protected final void init(long pageId, PageIO init) throws IgniteCheckedException
pageId
- Page ID.init
- IO for new page initialization.IgniteCheckedException
- if failed.protected final long recyclePage(long pageId, long page, long pageAddr, Boolean walPlc) throws IgniteCheckedException
pageId
- Page ID.page
- Page pointer.pageAddr
- Page address.walPlc
- Full page WAL record policy.IgniteCheckedException
- If failed.protected final int pageSize()
public void onBeforeWriteLock(int cacheId, long pageId, long page)
onBeforeWriteLock
in interface PageLockListener
cacheId
- Cache ID.pageId
- Page ID.page
- Page pointer.public void onWriteLock(int cacheId, long pageId, long page, long pageAddr)
onWriteLock
in interface PageLockListener
cacheId
- Cache ID.pageId
- Page ID.page
- Page pointer.pageAddr
- Page address.public void onWriteUnlock(int cacheId, long pageId, long page, long pageAddr)
onWriteUnlock
in interface PageLockListener
cacheId
- Cache ID.pageId
- Page ID.page
- Page pointer.pageAddr
- Page address.public void onBeforeReadLock(int cacheId, long pageId, long page)
onBeforeReadLock
in interface PageLockListener
cacheId
- Cache ID.pageId
- Page ID.page
- Page pointer.public void onReadLock(int cacheId, long pageId, long page, long pageAddr)
onReadLock
in interface PageLockListener
cacheId
- Cache ID.pageId
- Page ID.page
- Page pointer.pageAddr
- Page address.public void onReadUnlock(int cacheId, long pageId, long page, long pageAddr)
onReadUnlock
in interface PageLockListener
cacheId
- Cache ID.pageId
- Page ID.page
- Page pointer.pageAddr
- Page address.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017