Class FileVersionCheckingFactory
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.file.FileVersionCheckingFactory
-
public class FileVersionCheckingFactory extends Object
Checks version in files if it's present on the disk, creates store with latest version otherwise.
-
-
Field Summary
Fields Modifier and Type Field Description static intLATEST_VERSIONLatest page store version.static StringLATEST_VERSION_OVERRIDE_PROPERTYProperty to override latest version.
-
Constructor Summary
Constructors Constructor Description FileVersionCheckingFactory(FileIOFactory fileIOFactory, FileIOFactory fileIOFactoryStoreV1, IntSupplier pageSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PageStorecreatePageStore(byte type, File file, LongConsumer allocatedTracker)Creates instance of PageStore based on given file.PageStorecreatePageStore(byte type, IgniteOutClosure<Path> pathProvider, LongConsumer allocatedTracker)Creates instance of PageStore based on file path provider.intheaderSize(int ver)intlatestVersion()Resolves latest page store version.
-
-
-
Field Detail
-
LATEST_VERSION_OVERRIDE_PROPERTY
public static final String LATEST_VERSION_OVERRIDE_PROPERTY
Property to override latest version. Should be used only in tests.- See Also:
- Constant Field Values
-
LATEST_VERSION
public static final int LATEST_VERSION
Latest page store version.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileVersionCheckingFactory
public FileVersionCheckingFactory(FileIOFactory fileIOFactory, FileIOFactory fileIOFactoryStoreV1, IntSupplier pageSize)
- Parameters:
fileIOFactory- File IO factory.fileIOFactoryStoreV1- File IO factory for V1 page store and for version checking.pageSize- Page size supplier.
-
-
Method Detail
-
createPageStore
public PageStore createPageStore(byte type, File file, LongConsumer allocatedTracker) throws IgniteCheckedException
Creates instance of PageStore based on given file.- Parameters:
type- Data type, can bePageStore.TYPE_IDXorPageStore.TYPE_DATA.file- File Page store file.allocatedTracker- metrics updater.- Returns:
- page store
- Throws:
IgniteCheckedException- if failed.
-
createPageStore
public PageStore createPageStore(byte type, IgniteOutClosure<Path> pathProvider, LongConsumer allocatedTracker) throws IgniteCheckedException
Creates instance of PageStore based on file path provider.- Parameters:
type- Data type, can bePageStore.TYPE_IDXorPageStore.TYPE_DATApathProvider- File Page store path provider.allocatedTracker- metrics updater- Returns:
- page store
- Throws:
IgniteCheckedException- if failed
-
latestVersion
public int latestVersion()
Resolves latest page store version.
-
headerSize
public int headerSize(int ver)
- Parameters:
ver- Version.- Returns:
- Header size.
-
-