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

## Class PagePartitionCountersIO

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

    public class PagePartitionCountersIO
    extends PageIO

Page IO for Partition Counters, IO for pages containing cache ID mapping to its size. Used only for caches in shared cache groups.

### Field Summary

Fields
`static int` `ITEM_SIZE` One serialized entry size: Item size = 4 bytes (cache ID) + 8 bytes (cache size) = 12 bytes
`static IOVersions<PagePartitionCountersIO>` `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_CACHE_ID_DATA_REF_MVCC_INNER, T_CACHE_ID_DATA_REF_MVCC_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_DATA_REF_MVCC_INNER, T_DATA_REF_MVCC_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_EX_REF_MVCC_INNER_END, T_H2_EX_REF_MVCC_INNER_START, T_H2_EX_REF_MVCC_LEAF_END, T_H2_EX_REF_MVCC_LEAF_START, T_H2_MVCC_REF_INNER, T_H2_MVCC_REF_LEAF, 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, T_TX_LOG_INNER, T_TX_LOG_LEAF, TYPE_OFF, VER_OFF`

### Constructor Summary

Constructors
Constructor and Description
`PagePartitionCountersIO(int ver)`

### Method Summary

All Methods Instance Methods Concrete Methods
`long` `getNextCountersPageId(long pageAddr)`
`void` `initNewPage(long pageAddr, long pageId, int pageSize, PageMetrics metrics)`
`protected void` `printPage(long addr, int pageSize, GridStringBuilder sb)`
`boolean` `readCacheSizes(long pageAddr, Map<Integer,Long> res)`
`byte[]` `serializeCacheSizes(Map<Integer,Long> cacheSizes)`
`void` `setNextCountersPageId(long pageAddr, long partMetaPageId)`
`int` `writeCacheSizes(int pageSize, long pageAddr, byte[] cacheSizes, int itemsOff)`

### 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, 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

#### ITEM_SIZE

    public static final int ITEM_SIZE

One serialized entry size: Item size = 4 bytes (cache ID) + 8 bytes (cache size) = 12 bytes

See Also:
  Constant Field Values

#### VERSIONS

    public static final IOVersions<PagePartitionCountersIO> VERSIONS

### Constructor Detail

#### PagePartitionCountersIO

    public PagePartitionCountersIO(int ver)

Parameters:
  `ver` - Page format version.

### Method Detail

#### serializeCacheSizes

    public byte[] serializeCacheSizes(Map<Integer,Long> cacheSizes)

Parameters:
  `cacheSizes` - Cache sizes: cache Id in shared group mapped to its size. Not null.
Returns:
  Serialized cache sizes or 0-byte length array if map was empty.

#### initNewPage

    public void initNewPage(long pageAddr,
                            long pageId,
                            int pageSize,
                            PageMetrics metrics)

Overrides:
  `initNewPage` in class `PageIO`
Parameters:
  `pageAddr` - Page address.
  `pageId` - Page ID.
  `pageSize` - Page size.
  `metrics` - Page metrics for tracking page allocation. Can be `null` if no tracking is required.
See Also:
  `EncryptionSpi.encryptedSize(int)`

#### getNextCountersPageId

    public long getNextCountersPageId(long pageAddr)

Parameters:
  `pageAddr` - Page address.
Returns:
  Next counters page ID or `0` if it does not exist.

#### setNextCountersPageId

    public void setNextCountersPageId(long pageAddr,
                                      long partMetaPageId)

Parameters:
  `pageAddr` - Page address.
  `partMetaPageId` - Next counters page ID.

#### writeCacheSizes

    public int writeCacheSizes(int pageSize,
                               long pageAddr,
                               byte[] cacheSizes,
                               int itemsOff)

Parameters:
  `pageSize` - Page size without encryption overhead.
  `pageAddr` - Page address.
  `cacheSizes` - Serialized cache size items (pairs of cache ID and its size).
Returns:
  Number of written pairs.

#### readCacheSizes

    public boolean readCacheSizes(long pageAddr,
                                  Map<Integer,Long> res)

Parameters:
  `pageAddr` - Page address.
  `res` - Result map of cache sizes.
Returns:
  `True` if the map was fully read.

#### 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`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022