org.apache.ignite.internal.pagemem.store

## Interface IgnitePageStoreManager

All Superinterfaces:
  GridCacheSharedManager, IgniteChangeGlobalStateSupport

    public interface IgnitePageStoreManager
    extends GridCacheSharedManager, IgniteChangeGlobalStateSupport

### Method Summary

Methods
`long` `allocatePage(int cacheId, int partId, byte flags)` Allocates a page for the given page space.
`void` `beginRecover()` Invoked before starting checkpoint recover.
`void` `ensure(int cacheId, int partId)`
`boolean` `exists(int cacheId, int partId)` Checks if page exists.
`void` `finishRecover()` Invoked after checkpoint recover is finished.
`boolean` `hasIndexStore(int cacheId)`
`void` `initializeForCache(CacheConfiguration ccfg)` Callback called when a cache is starting.
`long` `metaPageId(int cacheId)` Gets meta page ID for specified cache.
`void` `onPartitionCreated(int cacheId, int partId)` Callback called when a partition is created on the local node.
`void` `onPartitionDestroyed(int cacheId, int partId, int tag)` Callback called when a partition for the given cache is evicted from the local node.
`long` `pageOffset(int cacheId, long pageId)` Gets page offset within the page store file.
`int` `pages(int cacheId, int partId)` Gets total number of allocated pages for the given space.
`void` `read(int cacheId, long pageId, ByteBuffer pageBuf)` Reads a page for the given cache ID.
`CacheConfiguration` `readConfiguration(String cacheName)`
`void` `readHeader(int cacheId, int partId, ByteBuffer buf)` Reads a header of apage store.
`Set<String>` `savedCacheNames()`
`void` `shutdownForCache(GridCacheContext cacheCtx, boolean destroy)` Callback called when a cache is stopping.
`void` `sync(int cacheId, int partId)` Makes sure that all previous writes to the store has been written to disk.
`void` `write(int cacheId, 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, 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()

Invoked after checkpoint recover is finished.

#### initializeForCache

    void initializeForCache(CacheConfiguration ccfg)
                            throws IgniteCheckedException

Callback called when a cache is starting.

Parameters:
  `ccfg` - Cache configuration of the cache being started.
Throws:
  `IgniteCheckedException` - If failed to handle cache start callback.

#### shutdownForCache

    void shutdownForCache(GridCacheContext cacheCtx,
                        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:
  `cacheCtx` - Cache context of the cache 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 cacheId,
                          int partId)
                            throws IgniteCheckedException

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

Parameters:
  `cacheId` - Cache 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 cacheId,
                            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:
  `cacheId` - Cache ID of the evicted partition.
  `partId` - Partition ID.
Throws:
  `IgniteCheckedException` - If failed to handle partition destroy callback.

#### read

    void read(int cacheId,
            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:
  `cacheId` - Cache ID.
  `pageId` - PageID to read.
  `pageBuf` - Page buffer to write to.
Throws:
  `IgniteCheckedException` - If failed to read the page.

#### exists

    boolean exists(int cacheId,
                 int partId)
                   throws IgniteCheckedException

Checks if page exists.

Parameters:
  `cacheId` - Cache ID.
  `partId` - Partition ID.
Returns:
  `True` if page exists.
Throws:
  `IgniteCheckedException` - If failed.

#### readHeader

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

Reads a header of apage store.

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

#### write

    void write(int cacheId,
             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:
  `cacheId` - Cache ID.
  `pageId` - Page ID.
  `pageBuf` - Page buffer to write.
Throws:
  `IgniteCheckedException` - If failed to write page.

#### pageOffset

    long pageOffset(int cacheId,
                  long pageId)
                    throws IgniteCheckedException

Gets page offset within the page store file.

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

#### sync

    void sync(int cacheId,
            int partId)
              throws IgniteCheckedException

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

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

#### ensure

    void ensure(int cacheId,
              int partId)
                throws IgniteCheckedException

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

#### allocatePage

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

Allocates a page for the given page space.

Parameters:
  `cacheId` - Cache 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 cacheId,
            int partId)
              throws IgniteCheckedException

Gets total number of allocated pages for the given space.

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

#### metaPageId

    long metaPageId(int cacheId)

Gets meta page ID for specified cache.

Parameters:
  `cacheId` - Cache ID.
Returns:
  Meta page ID.

#### savedCacheNames

    Set<String> savedCacheNames()

Returns:
  set of cache names which configurations were saved

#### readConfiguration

    CacheConfiguration readConfiguration(String cacheName)

Parameters:
  `cacheName` - Cache name.
Returns:
  saved configuration for cache

#### hasIndexStore

    boolean hasIndexStore(int cacheId)

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

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017