tkalkirill commented on code in PR #947: URL: https://github.com/apache/ignite-3/pull/947#discussion_r928591560
########## modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/store/AbstractFilePageStoreIo.java: ########## @@ -0,0 +1,611 @@ +/* + * 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.persistence.store; + +import static java.nio.ByteOrder.nativeOrder; +import static java.nio.file.StandardOpenOption.CREATE; +import static java.nio.file.StandardOpenOption.READ; +import static java.nio.file.StandardOpenOption.WRITE; +import static org.apache.ignite.internal.util.IgniteUtils.atomicMoveFile; +import static org.apache.ignite.internal.util.IgniteUtils.hexInt; +import static org.apache.ignite.internal.util.IgniteUtils.hexLong; +import static org.apache.ignite.internal.util.IgniteUtils.toHexString; +import static org.apache.ignite.lang.IgniteSystemProperties.getBoolean; + +import java.io.Closeable; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.ClosedByInterruptException; +import java.nio.channels.ClosedChannelException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import org.apache.ignite.internal.fileio.FileIo; +import org.apache.ignite.internal.fileio.FileIoFactory; +import org.apache.ignite.internal.pagememory.io.PageIo; +import org.apache.ignite.internal.pagememory.persistence.FastCrc; +import org.apache.ignite.internal.pagememory.persistence.IgniteInternalDataIntegrityViolationException; +import org.apache.ignite.lang.IgniteInternalCheckedException; +import org.jetbrains.annotations.Nullable; + +/** + * Abstract class for performing IO operations on file page storage. + */ +public abstract class AbstractFilePageStoreIo implements Closeable { + private final FileIoFactory ioFactory; + + private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); + + /** Skip CRC calculation flag. */ + // TODO: IGNITE-17011 Move to config + private final boolean skipCrc = getBoolean("IGNITE_PDS_SKIP_CRC"); + + private volatile Path filePath; + + private volatile @Nullable FileIo fileIo; + + /** Initialized file page store IO. */ + private volatile boolean initialized; + + /** Caches the existence state of file. After it is initialized, it will be not {@code null} during lifecycle. */ + private volatile @Nullable Boolean fileExists; + + /** + * Constructor. + * + * @param ioFactory {@link FileIo} factory. + * @param filePath File page store path. + */ + AbstractFilePageStoreIo(FileIoFactory ioFactory, Path filePath) { + this.ioFactory = ioFactory; + this.filePath = filePath; + } + + /** + * Returns the page size in bytes. + */ + public abstract int pageSize(); Review Comment: Discussed in person, I will not fix. -- 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]
