org.apache.ignite.internal.processors.cache.persistence.file

## 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
`static int` `LATEST_VERSION` Latest page store version.
`static String` `LATEST_VERSION_OVERRIDE_PROPERTY` Property to override latest version.

### Constructor Summary

Constructors
Constructor and Description
`FileVersionCheckingFactory(FileIOFactory fileIOFactory, FileIOFactory fileIOFactoryStoreV1, IntSupplier pageSize)`

### Method Summary

All Methods Instance Methods Concrete Methods
`PageStore` `createPageStore(byte type, File file, LongConsumer allocatedTracker)` Creates instance of PageStore based on given file.
`PageStore` `createPageStore(byte type, IgniteOutClosure<Path> pathProvider, LongConsumer allocatedTracker)` Creates instance of PageStore based on file path provider.
`int` `headerSize(int ver)`
`int` `latestVersion()` Resolves latest page store version.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 be `PageStore.TYPE_IDX` or `PageStore.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 be `PageStore.TYPE_IDX` or `PageStore.TYPE_DATA`
  `pathProvider` - 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.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023