Package org.apache.ignite.internal.processors.cache.persistence.tree.io

## Class BPlusMetaIO

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO
  - - org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusMetaIO

    public class BPlusMetaIO
    extends PageIO

IO routines for B+Tree meta pages.

### Field Summary

Fields
`static long` `DEFAULT_FLAGS`
`static IOVersions<BPlusMetaIO>` `VERSIONS`

### Fields inherited from class org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO

`COMMON_HEADER_END, CRC_OFF, MAX_PAYLOAD_SIZE, PAGE_ID_OFF, ROTATED_ID_PART_OFF, T_BPLUS_META, T_CACHE_ID_AWARE_DATA_REF_INNER, T_CACHE_ID_AWARE_DATA_REF_LEAF, T_CACHE_ID_AWARE_PENDING_REF_INNER, T_CACHE_ID_AWARE_PENDING_REF_LEAF, T_DATA, T_DATA_METASTORAGE, T_DATA_PART, T_DATA_REF_INNER, T_DATA_REF_LEAF, T_DATA_REF_METASTORAGE_INNER, T_DATA_REF_METASTORAGE_LEAF, T_DEFRAG_LINK_MAPPING_INNER, T_DEFRAG_LINK_MAPPING_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_MARKER_PAGE, T_META, T_METASTORE_INNER, T_METASTORE_LEAF, T_PAGE_LIST_META, T_PAGE_LIST_NODE, T_PAGE_UPDATE_TRACKING, T_PART_CNTRS, T_PART_META, T_PENDING_REF_INNER, T_PENDING_REF_LEAF, TYPE_OFF, VER_OFF`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addRoot​(long pageAddr, long rootPageId, int pageSize)`
`IgniteProductVersion` `createdVersion​(long pageAddr)`
`void` `cutRoot​(long pageAddr, int pageSize)`
`long` `getFirstPageId​(long pageAddr, int lvl)`
`int` `getFreeSpace​(int pageSize, long pageAddr)` Count of bytes that is currently free in this page and possibly can be used to place additional payload.
`int` `getInlineSize​(long pageAddr)`
`int` `getLevelsCount​(long pageAddr)`
`int` `getMaxLevels​(long pageAddr, int pageSize)`
`int` `getRootLevel​(long pageAddr)`
`void` `initFlagsAndVersion​(long pageAddr, long flags, IgniteProductVersion createdVer)`
`void` `initRoot​(long pageAdrr, long rootId, int pageSize)`
`boolean` `inlineObjectHash​(long pageAddr)` Whether Java objects should be inlined as hash or as bytes array.
`boolean` `inlineObjectSupported​(long pageAddr)`
`protected void` `printPage​(long addr, int pageSize, GridStringBuilder sb)`
`void` `setCreatedVersion​(long pageAddr, IgniteProductVersion curVer)`
`void` `setFlags​(long pageAddr, boolean unwrappedPk, boolean inlineObjSupported, boolean inlineObjHash)`
`void` `setInlineSize​(long pageAddr, int size)`
`static void` `setValues​(long pageAddr, int inlineSize, boolean unwrappedPk, boolean inlineObjSupported, boolean inlineObjHash)` Set meta page values.
`boolean` `supportFlags()`
`boolean` `unwrappedPk​(long pageAddr)`
`static void` `upgradePageVersion​(long pageAddr, boolean inlineObjSupported, boolean unwrappedPk, int pageSize)`

### Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO

`assertPageType, assertPageType, copyPage, deriveIndexPageType, getBPlusIO, getBPlusIO, getCompactedSize, getCompactedSize, getCompressedSize, getCompressedSize, getCompressionType, getCompressionType, getCrc, getCrc, getInnerVersions, getLeafVersions, getPageId, getPageId, getPageIO, getPageIO, getPageIO, getRotatedIdPart, getType, getType, getType, getVersion, getVersion, getVersion, initNewPage, isDataPageType, isIndexPage, printPage, registerH2, registerH2ExtraInner, registerH2ExtraLeaf, registerTest, registerTest, setCompactedSize, setCompressedSize, setCompressionType, setCrc, setCrc, setPageId, setRotatedIdPart, setType, setVersion, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### VERSIONS

    public static final IOVersions<BPlusMetaIO> VERSIONS

#### DEFAULT_FLAGS

    public static final long DEFAULT_FLAGS

See Also:
  Constant Field Values

### Method Detail

#### initRoot

    public void initRoot​(long pageAdrr,
                         long rootId,
                         int pageSize)

Parameters:
  `pageAdrr` - Page address.
  `rootId` - Root page ID.
  `pageSize` - Page size.

#### getLevelsCount

    public int getLevelsCount​(long pageAddr)

Parameters:
  `pageAddr` - Page address.
Returns:
  Number of levels in this tree.

#### getMaxLevels

    public int getMaxLevels​(long pageAddr,
                            int pageSize)

Parameters:
  `pageAddr` - Page address.
  `pageSize` - Page size.
Returns:
  Max levels possible for this page size.

#### getFirstPageId

    public long getFirstPageId​(long pageAddr,
                               int lvl)

Parameters:
  `pageAddr` - Page address.
  `lvl` - Level.
Returns:
  First page ID at that level.

#### getRootLevel

    public int getRootLevel​(long pageAddr)

Parameters:
  `pageAddr` - Page address.
Returns:
  Root level.

#### addRoot

    public void addRoot​(long pageAddr,
                        long rootPageId,
                        int pageSize)

Parameters:
  `pageAddr` - Page address.
  `rootPageId` - New root page ID.
  `pageSize` - Page size.

#### cutRoot

    public void cutRoot​(long pageAddr,
                        int pageSize)

Parameters:
  `pageAddr` - Page address.
  `pageSize` - Page size.

#### setInlineSize

    public void setInlineSize​(long pageAddr,
                              int size)

Parameters:
  `pageAddr` - Page address.
  `size` - Offset size.

#### getInlineSize

    public int getInlineSize​(long pageAddr)

Parameters:
  `pageAddr` - Page address.
Returns:
  Inline size.

#### unwrappedPk

    public boolean unwrappedPk​(long pageAddr)

Returns:
  `true` In case use unwrapped PK.

#### inlineObjectSupported

    public boolean inlineObjectSupported​(long pageAddr)

Parameters:
  `pageAddr` - Page address.
Returns:
  `true` In case inline object is supported by the tree.

#### inlineObjectHash

    public boolean inlineObjectHash​(long pageAddr)

Whether Java objects should be inlined as hash or as bytes array.

Parameters:
  `pageAddr` - Page address.

#### supportFlags

    public boolean supportFlags()

Returns:
  `true` If flags are supported.

#### initFlagsAndVersion

    public void initFlagsAndVersion​(long pageAddr,
                                    long flags,
                                    IgniteProductVersion createdVer)

Parameters:
  `pageAddr` - Page address.
  `flags` - Flags.
  `createdVer` - The version of the product that creates the page (b+tree).

#### setCreatedVersion

    public void setCreatedVersion​(long pageAddr,
                                  IgniteProductVersion curVer)

Parameters:
  `pageAddr` - Page address.
  `curVer` - Ignite current version.

#### createdVersion

    public IgniteProductVersion createdVersion​(long pageAddr)

Parameters:
  `pageAddr` - Page address.
Returns:
  The version of product that creates the page.

#### setFlags

    public void setFlags​(long pageAddr,
                         boolean unwrappedPk,
                         boolean inlineObjSupported,
                         boolean inlineObjHash)

Parameters:
  `pageAddr` - Page address.
  `unwrappedPk` - unwrapped primary key of this tree flag.
  `inlineObjSupported` - inline POJO by created tree flag.
  `inlineObjHash` - Whether Java objects should be inlined as hash or as bytes array.

#### printPage

    protected void printPage​(long addr,
                             int pageSize,
                             GridStringBuilder sb)
                      throws IgniteCheckedException

Specified by:
  `printPage` in class `PageIO`
Parameters:
  `addr` - Address.
  `pageSize` - Page size.
  `sb` - Sb.
Throws:
  `IgniteCheckedException`

#### getFreeSpace

    public int getFreeSpace​(int pageSize,
                            long pageAddr)

Count of bytes that is currently free in this page and possibly can be used to place additional payload.

Specified by:
  `getFreeSpace` in class `PageIO`
Parameters:
  `pageSize` - Page size.
  `pageAddr` - Page address.
Returns:
  Free space.

#### upgradePageVersion

    public static void upgradePageVersion​(long pageAddr,
                                          boolean inlineObjSupported,
                                          boolean unwrappedPk,
                                          int pageSize)

Parameters:
  `pageAddr` - Page address.
  `inlineObjSupported` - Supports inline object flag.
  `unwrappedPk` - Unwrap PK flag.
  `pageSize` - Page size.

#### setValues

    public static void setValues​(long pageAddr,
                                 int inlineSize,
                                 boolean unwrappedPk,
                                 boolean inlineObjSupported,
                                 boolean inlineObjHash)

Set meta page values.

Parameters:
  `pageAddr` - Page address.
  `inlineSize` - Inline size.
  `unwrappedPk` - Unwrap PK flag.
  `inlineObjSupported` - Supports inline object flag.
  `inlineObjHash` - Supports inline object hash flag.