public abstract class PageIO extends Object
PageIO has
static methods (like {@link #getPageId(long)}) intentionally:
this base format can not be changed between versions.
2. IO must correctly override initNewPage(long, long, int, PageMetrics) method and call super.
We have logic that relies on this behavior.
3. Page IO type ID constant must be declared in this class to have a list of all the
existing IO types in a single place.
4. IO must be added to getBPlusIO(int, int) or to getPageIO(int, int).
5. Always keep in mind that IOs are versioned and their format can change from version
to version. In this respect it is a good practice to avoid exposing details
of IO internal format on it's API. The API should be minimalistic and abstract, so that
internal format in future IO version can be completely changed without any changes
to the API of this page IO.
6. Page IO API should not have any version dependent semantics and should not change API
semantics in newer versions.
7. It is almost always preferable to read or write (especially write) page contents using
static methods on PageHandler. To just initialize new page use
PageHandler.initPage(PageMemory, int, long, PageIO, IgniteWriteAheadLogManager, PageLockListener, IoStatisticsHolder)
method with needed IO instance.| Modifier | Constructor and Description |
|---|---|
protected |
PageIO(int type,
int ver) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
copyPage(ByteBuffer page,
ByteBuffer out,
int pageSize) |
static IndexPageType |
deriveIndexPageType(long pageAddr) |
static <Q extends BPlusIO<?>> |
getBPlusIO(int type,
int ver) |
static <Q extends BPlusIO<?>> |
getBPlusIO(long pageAddr) |
static short |
getCompactedSize(ByteBuffer page) |
static short |
getCompactedSize(long pageAddr) |
static short |
getCompressedSize(ByteBuffer page) |
static short |
getCompressedSize(long pageAddr) |
static byte |
getCompressionType(ByteBuffer page) |
static byte |
getCompressionType(long pageAddr) |
static int |
getCrc(ByteBuffer buf) |
static int |
getCrc(long pageAddr) |
static IOVersions<? extends BPlusInnerIO<?>> |
getInnerVersions(int idx,
boolean mvcc) |
static IOVersions<? extends BPlusLeafIO<?>> |
getLeafVersions(int idx,
boolean mvcc) |
static long |
getPageId(ByteBuffer buf) |
static long |
getPageId(long pageAddr) |
static <Q extends PageIO> |
getPageIO(ByteBuffer page) |
static <Q extends PageIO> |
getPageIO(int type,
int ver) |
static <Q extends PageIO> |
getPageIO(long pageAddr) |
static int |
getRotatedIdPart(long pageAddr) |
int |
getType() |
static int |
getType(ByteBuffer buf) |
static int |
getType(long pageAddr) |
int |
getVersion() |
static int |
getVersion(ByteBuffer buf) |
static int |
getVersion(long pageAddr) |
void |
initNewPage(long pageAddr,
long pageId,
int pageSize,
@Nullable PageMetrics metrics) |
static boolean |
isDataPageType(int type) |
static boolean |
isIndexPage(int pageType)
Returns
true if the given page type is related to SQL index data pages. |
static String |
printPage(long addr,
int pageSize) |
protected abstract void |
printPage(long addr,
int pageSize,
GridStringBuilder sb) |
static void |
registerH2(IOVersions<? extends BPlusInnerIO<?>> innerIOs,
IOVersions<? extends BPlusLeafIO<?>> leafIOs,
IOVersions<? extends BPlusInnerIO<?>> mvccInnerIOs,
IOVersions<? extends BPlusLeafIO<?>> mvccLeafIOs)
Registers this B+Tree IO versions.
|
static void |
registerH2ExtraInner(IOVersions<? extends BPlusInnerIO<?>> innerExtIOs,
boolean mvcc)
Registers extra inner IO versions.
|
static void |
registerH2ExtraLeaf(IOVersions<? extends BPlusLeafIO<?>> leafExtIOs,
boolean mvcc)
Registers extra inner IO versions.
|
static void |
registerTest(BPlusInnerIO<?> innerIO,
BPlusLeafIO<?> leafIO)
Registers IOs for testing.
|
static void |
registerTest(PageIO io)
Registers IO for testing.
|
static void |
setCompactedSize(ByteBuffer page,
short compactedSize) |
static void |
setCompressedSize(ByteBuffer page,
short compressedSize) |
static void |
setCompressionType(ByteBuffer page,
byte compressType) |
static void |
setCrc(ByteBuffer buf,
int crc) |
static void |
setCrc(long pageAddr,
int crc) |
static void |
setPageId(long pageAddr,
long pageId) |
static void |
setRotatedIdPart(long pageAddr,
int rotatedIdPart) |
static void |
setType(long pageAddr,
int type) |
protected static void |
setVersion(long pageAddr,
int ver) |
String |
toString() |
public static final short MAX_PAYLOAD_SIZE
public static final int TYPE_OFF
public static final int VER_OFF
public static final int CRC_OFF
public static final int PAGE_ID_OFF
public static final int ROTATED_ID_PART_OFF
public static final int COMMON_HEADER_END
public static final short T_DATA
public static final short T_BPLUS_META
public static final short T_H2_REF_LEAF
public static final short T_H2_REF_INNER
public static final short T_DATA_REF_INNER
public static final short T_DATA_REF_LEAF
public static final short T_METASTORE_INNER
public static final short T_METASTORE_LEAF
public static final short T_PENDING_REF_INNER
public static final short T_PENDING_REF_LEAF
public static final short T_META
public static final short T_PAGE_LIST_META
public static final short T_PAGE_LIST_NODE
public static final short T_PART_META
public static final short T_PAGE_UPDATE_TRACKING
public static final short T_CACHE_ID_AWARE_DATA_REF_INNER
public static final short T_CACHE_ID_AWARE_DATA_REF_LEAF
public static final short T_CACHE_ID_AWARE_PENDING_REF_INNER
public static final short T_CACHE_ID_AWARE_PENDING_REF_LEAF
public static final short T_PART_CNTRS
public static final short T_DATA_METASTORAGE
public static final short T_DATA_REF_METASTORAGE_INNER
public static final short T_DATA_REF_METASTORAGE_LEAF
public static final short T_DATA_REF_MVCC_INNER
public static final short T_DATA_REF_MVCC_LEAF
public static final short T_CACHE_ID_DATA_REF_MVCC_INNER
public static final short T_CACHE_ID_DATA_REF_MVCC_LEAF
public static final short T_H2_MVCC_REF_LEAF
public static final short T_H2_MVCC_REF_INNER
public static final short T_TX_LOG_LEAF
public static final short T_TX_LOG_INNER
public static final short T_DATA_PART
public static final short T_MARKER_PAGE
public static final short T_DEFRAG_LINK_MAPPING_INNER
public static final short T_DEFRAG_LINK_MAPPING_LEAF
public static final short T_H2_EX_REF_LEAF_START
public static final short T_H2_EX_REF_LEAF_END
public static final short T_H2_EX_REF_INNER_START
public static final short T_H2_EX_REF_INNER_END
public static final short T_H2_EX_REF_MVCC_LEAF_START
public static final short T_H2_EX_REF_MVCC_LEAF_END
public static final short T_H2_EX_REF_MVCC_INNER_START
public static final short T_H2_EX_REF_MVCC_INNER_END
protected PageIO(int type,
int ver)
type - Page type.ver - Page format version.public static int getType(ByteBuffer buf)
buf - Buffer.public static int getType(long pageAddr)
pageAddr - Page address.public static void setType(long pageAddr,
int type)
pageAddr - Page address.type - Type.public static int getVersion(ByteBuffer buf)
buf - Buffer.public static int getVersion(long pageAddr)
pageAddr - Page address.protected static void setVersion(long pageAddr,
int ver)
pageAddr - Page address.ver - Version.public static long getPageId(ByteBuffer buf)
buf - Buffer.public static long getPageId(long pageAddr)
pageAddr - Page address.public static void setPageId(long pageAddr,
long pageId)
pageAddr - Page address.pageId - Page ID.public static int getRotatedIdPart(long pageAddr)
pageAddr - Page address.public static void setRotatedIdPart(long pageAddr,
int rotatedIdPart)
pageAddr - Page address.rotatedIdPart - Rotated page ID part.public static void setCompressionType(ByteBuffer page, byte compressType)
page - Page buffer.compressType - Compression type.public static byte getCompressionType(ByteBuffer page)
page - Page buffer.public static byte getCompressionType(long pageAddr)
pageAddr - Page address.public static void setCompressedSize(ByteBuffer page, short compressedSize)
page - Page buffer.compressedSize - Compressed size.public static short getCompressedSize(ByteBuffer page)
page - Page buffer.public static short getCompressedSize(long pageAddr)
pageAddr - Page address.public static void setCompactedSize(ByteBuffer page, short compactedSize)
page - Page buffer.compactedSize - Compacted size.public static short getCompactedSize(ByteBuffer page)
page - Page buffer.public static short getCompactedSize(long pageAddr)
pageAddr - Page address.public static int getCrc(long pageAddr)
pageAddr - Page address.public static void setCrc(long pageAddr,
int crc)
pageAddr - Page address.crc - Checksum.public static int getCrc(ByteBuffer buf)
buf - Buffer.public static void setCrc(ByteBuffer buf, int crc)
buf - Buffer.crc - Checksum.public static void registerH2(IOVersions<? extends BPlusInnerIO<?>> innerIOs, IOVersions<? extends BPlusLeafIO<?>> leafIOs, IOVersions<? extends BPlusInnerIO<?>> mvccInnerIOs, IOVersions<? extends BPlusLeafIO<?>> mvccLeafIOs)
innerIOs - Inner IO versions.leafIOs - Leaf IO versions.mvccInnerIOs - Inner IO versions with mvcc enabled.mvccLeafIOs - Leaf IO versions with mvcc enabled.public static void registerH2ExtraInner(IOVersions<? extends BPlusInnerIO<?>> innerExtIOs, boolean mvcc)
innerExtIOs - Extra versions.public static void registerH2ExtraLeaf(IOVersions<? extends BPlusLeafIO<?>> leafExtIOs, boolean mvcc)
leafExtIOs - Extra versions.public static IOVersions<? extends BPlusInnerIO<?>> getInnerVersions(int idx, boolean mvcc)
idx - Index.public static IOVersions<? extends BPlusLeafIO<?>> getLeafVersions(int idx, boolean mvcc)
idx - Index.public static void registerTest(BPlusInnerIO<?> innerIO, BPlusLeafIO<?> leafIO)
innerIO - Inner IO.leafIO - Leaf IO.public static void registerTest(PageIO io)
io - Page IO.public final int getType()
public final int getVersion()
public void initNewPage(long pageAddr,
long pageId,
int pageSize,
@Nullable
@Nullable PageMetrics metrics)
pageAddr - Page address.pageId - Page ID.pageSize - Page size.metrics - Page metrics for tracking page allocation. Can be null if no tracking is required.EncryptionSpi.encryptedSize(int)public static boolean isIndexPage(int pageType)
true if the given page type is related to SQL index data pages.pageType - Page type (can be obtained by getType(long) or getType(ByteBuffer) methods).public static <Q extends PageIO> Q getPageIO(long pageAddr) throws IgniteCheckedException
pageAddr - Page address.IgniteCheckedException - If failed.public static <Q extends PageIO> Q getPageIO(ByteBuffer page) throws IgniteCheckedException
page - Page.IgniteCheckedException - If failed.public static <Q extends PageIO> Q getPageIO(int type, int ver) throws IgniteCheckedException
type - IO Type.ver - IO Version.IgniteCheckedException - If failed.public static <Q extends BPlusIO<?>> Q getBPlusIO(long pageAddr) throws IgniteCheckedException
pageAddr - Page address.IgniteCheckedException - If failed.public static <Q extends BPlusIO<?>> Q getBPlusIO(int type, int ver) throws IgniteCheckedException
type - IO Type.ver - IO Version.IgniteCheckedException - If failed.public static IndexPageType deriveIndexPageType(long pageAddr)
pageAddr - Address of page.public static boolean isDataPageType(int type)
type - Type to test.True if data page.protected abstract void printPage(long addr,
int pageSize,
GridStringBuilder sb)
throws IgniteCheckedException
addr - Address.pageSize - Page size.sb - Sb.IgniteCheckedExceptionprotected final void copyPage(ByteBuffer page, ByteBuffer out, int pageSize)
page - Page.out - Output buffer.pageSize - Page size.public static String printPage(long addr, int pageSize)
addr - Address.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.11.0 Release Date : September 11 2021