org.apache.ignite.internal.pagemem.store

## Interface IgnitePageStoreManager

All Superinterfaces:
  GridCacheSharedManager, IgniteChangeGlobalStateSupport

All Known Implementing Classes:
  FilePageStoreManager

    public interface IgnitePageStoreManager
    extends GridCacheSharedManager, IgniteChangeGlobalStateSupport

### Method Summary

All Methods Instance Methods Abstract Methods
`long` `allocatePage(int grpId, int partId, byte flags)` Allocates a page for the given page space.
`void` `beforeCacheGroupStart(CacheGroupDescriptor grpDesc)`
`void` `beginRecover()` Invoked before starting checkpoint recover.
`boolean` `checkAndInitCacheWorkDir(CacheConfiguration cacheCfg)` Creates and initializes cache work directory retrieved from `cacheCfg`.
`void` `cleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred, boolean cleanFiles)` Cleanup cache store whether it matches the provided predicate and if matched store was previously initizlized.
`void` `cleanupPersistentSpace()` Cleanup persistent space for all caches except metastore.
`void` `cleanupPersistentSpace(CacheConfiguration cacheConfiguration)` Cleanup persistent space for cache.
`void` `ensure(int grpId, int partId)`
`boolean` `exists(int grpId, int partId)` Checks if partition store exists.
`void` `finishRecover()` Invoked after checkpoint recover is finished.
`boolean` `hasIndexStore(int grpId)`
`void` `initialize(int cacheId, int partitions, String workingDir, LongAdderMetric tracker)` Initializes disk store structures.
`void` `initializeForCache(CacheGroupDescriptor grpDesc, StoredCacheData cacheData)` Callback called when a cache is starting.
`void` `initializeForMetastorage()` Initializes disk cache store structures.
`long` `metaPageId(int grpId)` Gets meta page ID for specified cache.
`void` `onPartitionCreated(int grpId, int partId)` Callback called when a partition is created on the local node.
`void` `onPartitionDestroyed(int grpId, int partId, int tag)` Callback called when a partition for the given cache is evicted from the local node.
`long` `pageOffset(int grpId, long pageId)` Gets page offset within the page store file.
`int` `pages(int grpId, int partId)` Gets total number of allocated pages for the given space.
`long` `pagesAllocated(int grpId)` Calculates number of pages currently allocated for given cache group.
`void` `read(int grpId, long pageId, ByteBuffer pageBuf)` Reads a page for the given cache ID.
`Map<String,StoredCacheData>` `readCacheConfigurations()`
`void` `readHeader(int grpId, int partId, ByteBuffer buf)` Reads a header of a page store.
`void` `removeCacheData(StoredCacheData cacheData)` Remove cache configuration data file.
`void` `shutdownForCacheGroup(CacheGroupContext grp, boolean destroy)` Callback called when a cache is stopping.
`void` `storeCacheData(StoredCacheData cacheData, boolean overwrite)`
`void` `sync(int grpId, int partId)` Makes sure that all previous writes to the store has been written to disk.
`void` `write(int grpId, long pageId, ByteBuffer pageBuf, int tag)` Writes the page for the given cache ID.

### Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheSharedManager

`onDisconnected, onKernalStart, onKernalStop, onReconnected, printMemoryStats, start, stop`

### Methods inherited from interface org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport

`onActivate, onDeActivate`

### Method Detail

#### beginRecover

    void beginRecover()

Invoked before starting checkpoint recover.

#### finishRecover

    void finishRecover()
                throws IgniteCheckedException

Invoked after checkpoint recover is finished.

Throws:
  `IgniteCheckedException`

#### initialize

    void initialize(int cacheId,
                    int partitions,
                    String workingDir,
                    LongAdderMetric tracker)
             throws IgniteCheckedException

Initializes disk store structures.

Parameters:
  `cacheId` - Cache id.
  `partitions` - Partitions count.
  `workingDir` - Working directory.
  `tracker` - Allocation tracker.
Throws:
  `IgniteCheckedException` - If failed.

#### initializeForCache

    void initializeForCache(CacheGroupDescriptor grpDesc,
                            StoredCacheData cacheData)
                     throws IgniteCheckedException

Callback called when a cache is starting.

Parameters:
  `grpDesc` - Cache group descriptor.
  `cacheData` - Cache data of the cache being started.
Throws:
  `IgniteCheckedException` - If failed to handle cache start callback.

#### initializeForMetastorage

    void initializeForMetastorage()
                           throws IgniteCheckedException

Initializes disk cache store structures.

Throws:
  `IgniteCheckedException`

#### shutdownForCacheGroup

    void shutdownForCacheGroup(CacheGroupContext grp,
                               boolean destroy)
                        throws IgniteCheckedException

Callback called when a cache is stopping. After this callback is invoked, no data associated with the given cache will be stored on disk.

Parameters:
  `grp` - Cache group being stopped.
  `destroy` - Flag indicating if the cache is being destroyed and data should be cleaned.
Throws:
  `IgniteCheckedException` - If failed to handle cache destroy callback.

#### onPartitionCreated

    void onPartitionCreated(int grpId,
                            int partId)
                     throws IgniteCheckedException

Callback called when a partition is created on the local node.

Parameters:
  `grpId` - Cache group ID where the partition is being created.
  `partId` - ID of the partition being created.
Throws:
  `IgniteCheckedException` - If failed to handle partition create callback.

#### onPartitionDestroyed

    void onPartitionDestroyed(int grpId,
                              int partId,
                              int tag)
                       throws IgniteCheckedException

Callback called when a partition for the given cache is evicted from the local node. After this callback is invoked, no data associated with the partition will be stored on disk.

Parameters:
  `grpId` - Cache group ID of the evicted partition.
  `partId` - Partition ID.
  `tag` - Partition tag (growing 1-based partition file version).
Throws:
  `IgniteCheckedException` - If failed to handle partition destroy callback.

#### read

    void read(int grpId,
              long pageId,
              ByteBuffer pageBuf)
       throws IgniteCheckedException

Reads a page for the given cache ID. Cache ID may be `0` if the page is a meta page.

Parameters:
  `grpId` - Cache group ID.
  `pageId` - PageID to read.
  `pageBuf` - Page buffer to write to.
Throws:
  `IgniteCheckedException` - If failed to read the page.

#### exists

    boolean exists(int grpId,
                   int partId)
            throws IgniteCheckedException

Checks if partition store exists.

Parameters:
  `grpId` - Cache group ID.
  `partId` - Partition ID.
Returns:
  `True` if partition store exists.
Throws:
  `IgniteCheckedException` - If failed.

#### readHeader

    void readHeader(int grpId,
                    int partId,
                    ByteBuffer buf)
             throws IgniteCheckedException

Reads a header of a page store.

Parameters:
  `grpId` - Cache group ID.
  `partId` - Partition ID.
  `buf` - Buffer to write to.
Throws:
  `IgniteCheckedException` - If failed.

#### write

    void write(int grpId,
               long pageId,
               ByteBuffer pageBuf,
               int tag)
        throws IgniteCheckedException

Writes the page for the given cache ID. Cache ID may be `0` if the page is a meta page.

Parameters:
  `grpId` - Cache group ID.
  `pageId` - Page ID.
  `pageBuf` - Page buffer to write.
Throws:
  `IgniteCheckedException` - If failed to write page.

#### pageOffset

    long pageOffset(int grpId,
                    long pageId)
             throws IgniteCheckedException

Gets page offset within the page store file.

Parameters:
  `grpId` - Cache group ID.
  `pageId` - Page ID.
Returns:
  Page offset.
Throws:
  `IgniteCheckedException` - If failed.

#### sync

    void sync(int grpId,
              int partId)
       throws IgniteCheckedException

Makes sure that all previous writes to the store has been written to disk.

Parameters:
  `grpId` - Cache group ID to sync.
  `partId` - Partition ID to sync.
Throws:
  `IgniteCheckedException` - If IO error occurred while running sync.

#### ensure

    void ensure(int grpId,
                int partId)
         throws IgniteCheckedException

Parameters:
  `grpId` - Cache group ID.
  `partId` - Partition ID.
Throws:
  `IgniteCheckedException` - If failed.

#### allocatePage

    long allocatePage(int grpId,
                      int partId,
                      byte flags)
               throws IgniteCheckedException

Allocates a page for the given page space.

Parameters:
  `grpId` - Cache group ID.
  `partId` - Partition ID. Used only if `flags` is equal to `PageIdAllocator.FLAG_DATA`.
  `flags` - Page allocation flags.
Returns:
  Allocated page ID.
Throws:
  `IgniteCheckedException` - If IO exception occurred while allocating a page ID.

#### pages

    int pages(int grpId,
              int partId)
       throws IgniteCheckedException

Gets total number of allocated pages for the given space.

Parameters:
  `grpId` - Cache group ID.
  `partId` - Partition ID.
Returns:
  Number of allocated pages.
Throws:
  `IgniteCheckedException` - If failed.

#### metaPageId

    long metaPageId(int grpId)

Gets meta page ID for specified cache.

Parameters:
  `grpId` - Cache group ID.
Returns:
  Meta page ID.

#### readCacheConfigurations

    Map<String,StoredCacheData> readCacheConfigurations()
                                                 throws IgniteCheckedException

Returns:
  Saved cache configurations.
Throws:
  `IgniteCheckedException` - If failed.

#### storeCacheData

    void storeCacheData(StoredCacheData cacheData,
                        boolean overwrite)
                 throws IgniteCheckedException

Parameters:
  `cacheData` - Cache configuration.
  `overwrite` - Whether stored configuration should be overwritten if it exists.
Throws:
  `IgniteCheckedException` - If failed.

#### removeCacheData

    void removeCacheData(StoredCacheData cacheData)
                  throws IgniteCheckedException

Remove cache configuration data file.

Parameters:
  `cacheData` - Cache configuration.
Throws:
  `IgniteCheckedException` - If failed.

#### hasIndexStore

    boolean hasIndexStore(int grpId)

Parameters:
  `grpId` - Cache group ID.
Returns:
  `True` if index store for given cache group existed before node started.

#### beforeCacheGroupStart

    void beforeCacheGroupStart(CacheGroupDescriptor grpDesc)

Parameters:
  `grpDesc` - Cache group descriptor.

#### pagesAllocated

    long pagesAllocated(int grpId)

Calculates number of pages currently allocated for given cache group.

Parameters:
  `grpId` - cache group id.
Returns:
  number of pages.

#### cleanupPersistentSpace

    void cleanupPersistentSpace(CacheConfiguration cacheConfiguration)
                         throws IgniteCheckedException

Cleanup persistent space for cache.

Parameters:
  `cacheConfiguration` - Cache configuration of cache which should be cleanup.
Throws:
  `IgniteCheckedException`

#### cleanupPersistentSpace

    void cleanupPersistentSpace()
                         throws IgniteCheckedException

Cleanup persistent space for all caches except metastore.

Throws:
  `IgniteCheckedException`

#### cleanupPageStoreIfMatch

    void cleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred,
                                 boolean cleanFiles)

Cleanup cache store whether it matches the provided predicate and if matched store was previously initizlized.

Parameters:
  `cacheGrpPred` - Predicate to match by id cache group stores to clean.
  `cleanFiles` - `True` to delete all persisted files related to particular store.

#### checkAndInitCacheWorkDir

    boolean checkAndInitCacheWorkDir(CacheConfiguration cacheCfg)
                              throws IgniteCheckedException

Creates and initializes cache work directory retrieved from `cacheCfg`.

Parameters:
  `cacheCfg` - Cache configuration.
Returns:
  `True` if work directory already exists.
Throws:
  `IgniteCheckedException` - If failed.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.1
Release Date | : May 21 2020