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 Modifier and Type Field Description static intITEM_SIZEOne serialized entry size: Item size = 4 bytes (cache ID) + 8 bytes (cache size) = 12 bytesstatic 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_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
-
-
Constructor Summary
Constructors Constructor Description PagePartitionCountersIO(int ver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCapacity(int pageSize)intgetFreeSpace(int pageSize, long pageAddr)Count of bytes that is currently free in this page and possibly can be used to place additional payload.longgetNextCountersPageId(long pageAddr)voidinitNewPage(long pageAddr, long pageId, int pageSize, PageMetrics metrics)protected voidprintPage(long addr, int pageSize, GridStringBuilder sb)booleanreadCacheSizes(long pageAddr, Map<Integer,Long> res)byte[]serializeCacheSizes(Map<Integer,Long> cacheSizes)voidsetNextCountersPageId(long pageAddr, long partMetaPageId)intwriteCacheSizes(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
-
-
-
-
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
-
-
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:
initNewPagein classPageIO- Parameters:
pageAddr- Page address.pageId- Page ID.pageSize- Page size.metrics- Page metrics for tracking page allocation. Can benullif 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
0if 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:
Trueif the map was fully read.
-
getCapacity
public int getCapacity(int pageSize)
- Parameters:
pageSize- Page size.- Returns:
- Maximum number of items which can be stored in buffer.
-
printPage
protected void printPage(long addr, int pageSize, GridStringBuilder sb) throws IgniteCheckedException- Specified by:
printPagein classPageIO- 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:
getFreeSpacein classPageIO- Parameters:
pageSize- Page size.pageAddr- Page address.- Returns:
- Free space.
-
-