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) 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)
method with needed IO instance.| Modifier | Constructor and Description |
|---|---|
protected |
PageIO(int type,
int ver) |
| Modifier and Type | Method and Description |
|---|---|
static <Q extends BPlusIO<?>> |
getBPlusIO(int type,
int ver) |
static <Q extends BPlusIO<?>> |
getBPlusIO(long pageAddr) |
static int |
getCrc(ByteBuffer buf) |
static int |
getCrc(long pageAddr) |
static IOVersions<? extends BPlusInnerIO<?>> |
getInnerVersions(int idx) |
static IOVersions<? extends BPlusLeafIO<?>> |
getLeafVersions(int idx) |
static long |
getPageId(ByteBuffer buf) |
static long |
getPageId(long pageAddr) |
static <Q extends PageIO> |
getPageIO(int type,
int ver) |
static <Q extends PageIO> |
getPageIO(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) |
static boolean |
isDataPageType(int type) |
static void |
registerH2(IOVersions<? extends BPlusInnerIO<?>> innerIOs,
IOVersions<? extends BPlusLeafIO<?>> leafIOs)
Registers this B+Tree IO versions.
|
static void |
registerH2ExtraInner(IOVersions<? extends BPlusInnerIO<?>> innerExtIOs)
Registers extra inner IO versions.
|
static void |
registerH2ExtraLeaf(IOVersions<? extends BPlusLeafIO<?>> leafExtIOs)
Registers extra inner IO versions.
|
static void |
registerTest(BPlusInnerIO<?> innerIO,
BPlusLeafIO<?> leafIO)
Registers IOs for testing.
|
static void |
setCrc(ByteBuffer buf,
int crc) |
static void |
setCrc(long pageAddr,
int crc) |
static void |
setPageId(long pageAddr,
long pageId) |
static void |
setType(long pageAddr,
int type) |
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 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_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
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 addres.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.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 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)
innerIOs - Inner IO versions.leafIOs - Leaf IO versions.public static void registerH2ExtraInner(IOVersions<? extends BPlusInnerIO<?>> innerExtIOs)
innerExtIOs - Extra versions.public static void registerH2ExtraLeaf(IOVersions<? extends BPlusLeafIO<?>> leafExtIOs)
leafExtIOs - Extra versions.public static IOVersions<? extends BPlusInnerIO<?>> getInnerVersions(int idx)
idx - Index.public static IOVersions<? extends BPlusLeafIO<?>> getLeafVersions(int idx)
idx - Index.public static void registerTest(BPlusInnerIO<?> innerIO, BPlusLeafIO<?> leafIO)
innerIO - Inner IO.leafIO - Leaf IO.public final int getType()
public final int getVersion()
public void initNewPage(long pageAddr,
long pageId,
int pageSize)
pageAddr - Page address.pageId - Page ID.pageSize - Page size.public static <Q extends PageIO> Q getPageIO(long pageAddr) throws IgniteCheckedException
pageAddr - Page address.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 boolean isDataPageType(int type)
type - Type to test.True if data page.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.2.0 Release Date : September 15 2017