ibessonov commented on a change in pull request #566:
URL: https://github.com/apache/ignite-3/pull/566#discussion_r790488135



##########
File path: 
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/io/PageIo.java
##########
@@ -0,0 +1,501 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.pagememory.io;
+
+import java.nio.ByteBuffer;
+import org.apache.ignite.internal.pagememory.PageMemory;
+import org.apache.ignite.internal.pagememory.metric.IoStatisticsHolder;
+import org.apache.ignite.internal.pagememory.util.PageHandler;
+import org.apache.ignite.internal.pagememory.util.PageIdUtils;
+import org.apache.ignite.internal.pagememory.util.PageLockListener;
+import org.apache.ignite.internal.pagememory.util.PageUtils;
+import org.apache.ignite.lang.IgniteInternalCheckedException;
+
+/**
+ * Base format for all the page types.
+ *
+ * <p>Checklist for page IO implementations and usage (The Rules):
+ *
+ * <p>1. IO should not have any `public static` methods. We have versioned IOs 
and any static method will mean that it have to always work
+ * in backward compatible way between all the IO versions. The base class 
{@link PageIo} has static methods (like {@link #getPageId(long)})
+ * intentionally: this base format can not be changed between versions.
+ *
+ * <p>2. IO must correctly override {@link #initNewPage(long, long, int)} 
method and call super. We have logic that relies on this behavior.
+ *
+ * <p>3. 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.
+ *
+ * <p>4. Page IO API should not have any version dependent semantics and 
should not change API semantics in newer versions.
+ *
+ * <p>5. It is almost always preferable to read or write (especially write) 
page contents using static methods on {@link PageHandler}. To
+ * just initialize new page use {@link PageHandler#initPage(PageMemory, int, 
long, PageIo, PageLockListener, IoStatisticsHolder)} method
+ * with needed IO instance.
+ */

Review comment:
       Dude, why? I will commit it, but it's unnecessary




-- 
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]


Reply via email to