tkalkirill commented on code in PR #1175:
URL: https://github.com/apache/ignite-3/pull/1175#discussion_r990039910
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/util/PartitionlessLinks.java:
##########
@@ -92,4 +100,45 @@ public static void writeToBuffer(ByteBuffer buffer, long
link) {
buffer.putInt(pageIndex(link));
}
+
+ /**
+ * Reads a partitionless page ID from the memory.
+ *
+ * @param addr Address in memory.
+ * @param off Offset from {@code addr} in bytes.
+ * @param partId Partition ID.
+ * @return Page ID with partition ID.
+ */
+ public static long readPartitionlessPageId(long addr, int off, int partId)
{
Review Comment:
Fix it
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/util/PartitionlessLinks.java:
##########
@@ -92,4 +100,45 @@ public static void writeToBuffer(ByteBuffer buffer, long
link) {
buffer.putInt(pageIndex(link));
}
+
+ /**
+ * Reads a partitionless page ID from the memory.
+ *
+ * @param addr Address in memory.
+ * @param off Offset from {@code addr} in bytes.
+ * @param partId Partition ID.
+ * @return Page ID with partition ID.
+ */
+ public static long readPartitionlessPageId(long addr, int off, int partId)
{
+ long rotationId = getByte(addr, off) & 0xFF;
+
+ byte flag = getByte(addr, off + Byte.BYTES);
+
+ int pageIdx = getInt(addr, off + Byte.BYTES + Byte.BYTES);
+
+ return pageId(partId, flag, pageIdx, rotationId);
+ }
+
+ /**
+ * Writes a partitionless page ID to memory.
+ * <ul>
+ * <li>{@link PageIdUtils#rotationId} - 1 byte;</li>
+ * <li>{@link PageIdUtils#flag Flag} - 1 byte;</li>
+ * <li>{@link PageIdUtils#pageIndex Page index} - 4 bytes.</li>
+ * </ul>
+ *
+ * @param addr Address in memory.
+ * @param off Offset from {@code addr} in bytes.
+ * @param pageId Page ID.
+ * @return Number of bytes written (equal to {@link
#PARTITIONLESS_PAGE_ID_SIZE_BYTES}).
+ */
+ public static long writePartitionlessPageId(long addr, int off, long
pageId) {
Review Comment:
Fix it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]