public abstract class BPlusIO<L> extends PageIO
Modifier and Type | Field and Description |
---|---|
protected static int |
ITEMS_OFF |
protected int |
itemSize
All the items must be of fixed size.
|
COMMON_HEADER_END, CRC_OFF, MAX_PAYLOAD_SIZE, PAGE_ID_OFF, T_BPLUS_META, T_DATA, T_DATA_REF_INNER, T_DATA_REF_LEAF, T_H2_EX_REF_INNER_END, T_H2_EX_REF_INNER_START, T_H2_EX_REF_LEAF_END, T_H2_EX_REF_LEAF_START, T_H2_REF_INNER, T_H2_REF_LEAF, T_META, T_METASTORE_INNER, T_METASTORE_LEAF, T_PAGE_LIST_META, T_PAGE_LIST_NODE, T_PAGE_UPDATE_TRACKING, T_PART_META, T_PENDING_REF_INNER, T_PENDING_REF_LEAF, TYPE_OFF, VER_OFF
Modifier | Constructor and Description |
---|---|
protected |
BPlusIO(int type,
int ver,
boolean leaf,
boolean canGetRow,
int itemSize) |
Modifier and Type | Method and Description |
---|---|
boolean |
canGetRow() |
abstract void |
copyItems(long srcPageAddr,
long dstPageAddr,
int srcIdx,
int dstIdx,
int cnt,
boolean cpLeft)
Copy items from source page to destination page.
|
int |
getCount(long pageAddr) |
long |
getForward(long pageAddr) |
int |
getItemSize() |
abstract L |
getLookupRow(BPlusTree<L,?> tree,
long pageAddr,
int idx)
Get lookup row.
|
abstract int |
getMaxCount(long pageAddr,
int pageSize) |
long |
getRemoveId(long pageAddr) |
void |
initNewPage(long pageAddr,
long pageId,
int pageSize) |
byte[] |
insert(long pageAddr,
int idx,
L row,
byte[] rowBytes,
long rightId,
boolean needRowBytes) |
boolean |
isLeaf() |
boolean |
merge(BPlusIO<L> prntIo,
long prntPageAddr,
int prntIdx,
long leftPageAddr,
long rightPageAddr,
boolean emptyBranch,
int pageSize) |
abstract int |
offset(int idx) |
void |
remove(long pageAddr,
int idx,
int cnt) |
void |
setCount(long pageAddr,
int cnt) |
void |
setForward(long pageAddr,
long pageId) |
void |
setRemoveId(long pageAddr,
long rmvId) |
void |
splitExistingPage(long pageAddr,
int mid,
long fwdId) |
void |
splitForwardPage(long pageAddr,
long fwdId,
long fwdPageAddr,
int mid,
int cnt,
int pageSize) |
abstract void |
store(long dstPageAddr,
int dstIdx,
BPlusIO<L> srcIo,
long srcPageAddr,
int srcIdx)
Store row info from the given source.
|
byte[] |
store(long pageAddr,
int idx,
L row,
byte[] rowBytes,
boolean needRowBytes)
Store the needed info about the row in the page.
|
abstract void |
storeByOffset(long pageAddr,
int off,
L row)
Store the needed info about the row in the page.
|
void |
visit(long pageAddr,
IgniteInClosure<L> c) |
getBPlusIO, getBPlusIO, getCrc, getCrc, getInnerVersions, getLeafVersions, getPageId, getPageId, getPageIO, getPageIO, getType, getType, getType, getVersion, getVersion, getVersion, registerH2, registerH2ExtraInner, registerH2ExtraLeaf, registerTest, setCrc, setCrc, setPageId, setType, toString
protected static final int ITEMS_OFF
protected final int itemSize
protected BPlusIO(int type, int ver, boolean leaf, boolean canGetRow, int itemSize)
type
- Page type.ver
- Page format version.leaf
- If this is a leaf IO.canGetRow
- If we can get full row from this page.public final int getItemSize()
public void initNewPage(long pageAddr, long pageId, int pageSize)
initNewPage
in class PageIO
pageAddr
- Page address.pageId
- Page ID.pageSize
- Page size.public final long getForward(long pageAddr)
pageAddr
- Page address.public final void setForward(long pageAddr, long pageId)
pageAddr
- Page address.pageId
- Forward page ID.public final long getRemoveId(long pageAddr)
pageAddr
- Page address.public final void setRemoveId(long pageAddr, long rmvId)
pageAddr
- Page address.rmvId
- Remove ID.public final int getCount(long pageAddr)
pageAddr
- Page address.public final void setCount(long pageAddr, int cnt)
pageAddr
- Page address.cnt
- Count.public final boolean canGetRow()
true
If we can get the full row from this page using
method BPlusTree.getRow(BPlusIO, long, int)
.
Must always be true
for leaf pages.public final boolean isLeaf()
true
if it is a leaf page.public abstract int getMaxCount(long pageAddr, int pageSize)
pageAddr
- Page address.pageSize
- Page size.public final byte[] store(long pageAddr, int idx, L row, byte[] rowBytes, boolean needRowBytes) throws IgniteCheckedException
pageAddr
- Page address.idx
- Index.row
- Lookup or full row.rowBytes
- Row bytes.needRowBytes
- If we need stored row bytes.IgniteCheckedException
- If failed.public abstract int offset(int idx)
idx
- Index of element.public abstract void storeByOffset(long pageAddr, int off, L row) throws IgniteCheckedException
pageAddr
- Page address.off
- Offset in bytes.row
- Lookup or full row.IgniteCheckedException
- If failed.public abstract void store(long dstPageAddr, int dstIdx, BPlusIO<L> srcIo, long srcPageAddr, int srcIdx) throws IgniteCheckedException
dstPageAddr
- Destination page address.dstIdx
- Destination index.srcIo
- Source IO.srcPageAddr
- Source page address.srcIdx
- Source index.IgniteCheckedException
- If failed.public abstract L getLookupRow(BPlusTree<L,?> tree, long pageAddr, int idx) throws IgniteCheckedException
tree
- Tree.pageAddr
- Page address.idx
- Index.IgniteCheckedException
- If failed.public abstract void copyItems(long srcPageAddr, long dstPageAddr, int srcIdx, int dstIdx, int cnt, boolean cpLeft) throws IgniteCheckedException
srcPageAddr
- Source page address.dstPageAddr
- Destination page address.srcIdx
- Source begin index.dstIdx
- Destination begin index.cnt
- Items count.cpLeft
- Copy leftmost link (makes sense only for inner pages).IgniteCheckedException
- If failed.public byte[] insert(long pageAddr, int idx, L row, byte[] rowBytes, long rightId, boolean needRowBytes) throws IgniteCheckedException
pageAddr
- Page address.idx
- Index.row
- Row to insert.rowBytes
- Row bytes.rightId
- Page ID which will be to the right child for the inserted item.needRowBytes
- If we need stored row bytes.IgniteCheckedException
- If failed.public void splitForwardPage(long pageAddr, long fwdId, long fwdPageAddr, int mid, int cnt, int pageSize) throws IgniteCheckedException
pageAddr
- Splitting page address.fwdId
- Forward page ID.fwdPageAddr
- Forward page address.mid
- Bisection index.cnt
- Initial elements count in the page being split.pageSize
- Page size.IgniteCheckedException
- If failed.public void splitExistingPage(long pageAddr, int mid, long fwdId)
pageAddr
- Page address.mid
- Bisection index.fwdId
- New forward page ID.public void remove(long pageAddr, int idx, int cnt) throws IgniteCheckedException
pageAddr
- Page address.idx
- Index.cnt
- Count.IgniteCheckedException
- If failed.public boolean merge(BPlusIO<L> prntIo, long prntPageAddr, int prntIdx, long leftPageAddr, long rightPageAddr, boolean emptyBranch, int pageSize) throws IgniteCheckedException
prntIo
- Parent IO.prntPageAddr
- Parent page address.prntIdx
- Split key index in parent.leftPageAddr
- Left page address.rightPageAddr
- Right page address.emptyBranch
- We are merging an empty branch.pageSize
- Page size.false
If we were not able to merge.IgniteCheckedException
- If failed.public void visit(long pageAddr, IgniteInClosure<L> c)
pageAddr
- Page address.c
- Closure.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017