org.apache.ignite.internal.processors.cache.database

## Class IgniteCacheDatabaseSharedManager

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter
  - - org.apache.ignite.internal.processors.cache.database.IgniteCacheDatabaseSharedManager

All Implemented Interfaces:
  GridCacheSharedManager, IgniteChangeGlobalStateSupport

    public class IgniteCacheDatabaseSharedManager
    extends GridCacheSharedManagerAdapter
    implements IgniteChangeGlobalStateSupport

### Field Summary

Fields
`protected MemoryPolicy` `dfltMemPlc`
`protected Map<String,MemoryMetrics>` `memMetricsMap`
`protected Map<String,MemoryPolicy>` `memPlcMap`

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter

`cctx, log`

### Constructor Summary

Constructors
Constructor and Description
`IgniteCacheDatabaseSharedManager()`

### Method Summary

Methods
`void` `beforeCachesStop()`
`void` `beforeExchange(GridDhtPartitionsExchangeFuture discoEvt)`
`protected File` `buildAllocPath(MemoryPolicyConfiguration plc)` Builds allocation path for memory mapped file to be used with PageMemory.
`protected File` `buildPath(String path, String consId)`
`void` `checkpointReadLock()` No-op for non-persistent storage.
`void` `checkpointReadUnlock()` No-op for non-persistent storage.
`protected void` `checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg, MemoryConfiguration dbCfg)`
`protected PageMemory` `createPageMemory(DirectMemoryProvider memProvider, MemoryConfiguration memCfg, MemoryPolicyConfiguration memPlcCfg, MemoryMetricsImpl memMetrics)` Creates PageMemory with given size and memory provider.
`void` `dumpStatistics(IgniteLogger log)`
`void` `ensureFreeSpace(MemoryPolicy memPlc)` See `GridCacheMapEntry.ensureFreeSpace()`
`FreeList` `freeList(String memPlcName)`
`IgniteInternalFuture` `indexRebuildFuture(int cacheId)`
`void` `init()`
`void` `initDataBase()`
`protected void` `initPageMemoryDataStructures(MemoryConfiguration dbCfg)`
`protected void` `initPageMemoryPolicies(MemoryConfiguration memCfg)`
`void` `lock()`
`Collection<MemoryMetrics>` `memoryMetrics()`
`Collection<MemoryPolicy>` `memoryPolicies()`
`MemoryPolicy` `memoryPolicy(String memPlcName)`
`void` `onActivate(GridKernalContext kctx)` Called when cluster performing activation.
`void` `onCacheStop(GridCacheContext cctx)`
`void` `onDeActivate(GridKernalContext kctx)` Called when cluster performing deactivation.
`int` `pageSize()`
`boolean` `persistenceEnabled()`
`ReuseList` `reuseList(String memPlcName)`
`protected void` `start0()`
`IgniteInternalFuture` `startLocalSnapshotCreation(StartFullSnapshotAckDiscoveryMessage snapshotMsg, ClusterNode initiator, String msg)`
`protected void` `stop0(boolean cancel)`
`String` `systemMemoryPolicyName()`
`void` `unLock()`
`void` `waitForCheckpoint(String reason)` Waits until current state is checkpointed.
`IgniteInternalFuture` `wakeupForCheckpoint(String reason)`
`IgniteInternalFuture` `wakeupForSnapshot(long snapshotId, UUID snapshotNodeId, Collection<String> cacheNames)`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter

`context, isStopping, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStart, onKernalStart0, onKernalStop, onKernalStop0, printMemoryStats, start, startInfo, stop, stopInfo, toString`

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

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

### Field Detail

#### memPlcMap

    protected Map<String,MemoryPolicy> memPlcMap

#### memMetricsMap

    protected Map<String,MemoryMetrics> memMetricsMap

#### dfltMemPlc

    protected MemoryPolicy dfltMemPlc

### Constructor Detail

#### IgniteCacheDatabaseSharedManager

    public IgniteCacheDatabaseSharedManager()

### Method Detail

#### start0

    protected void start0()
                   throws IgniteCheckedException

Overrides:
  `start0` in class `GridCacheSharedManagerAdapter`
Throws:
  `IgniteCheckedException` - If failed.

#### init

    public void init()
              throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If failed.

#### initPageMemoryDataStructures

    protected void initPageMemoryDataStructures(MemoryConfiguration dbCfg)
                                         throws IgniteCheckedException

Parameters:
  `dbCfg` - Database config.
Throws:
  `IgniteCheckedException`

#### pageSize

    public int pageSize()

Returns:
  Size of page used for PageMemory regions.

#### initPageMemoryPolicies

    protected void initPageMemoryPolicies(MemoryConfiguration memCfg)

Parameters:
  `memCfg` - Database config.

#### checkPolicyEvictionProperties

    protected void checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg,
                                     MemoryConfiguration dbCfg)
                                          throws IgniteCheckedException

Parameters:
  `plcCfg` - MemoryPolicyConfiguration to validate.
  `dbCfg` - Memory configuration.
Throws:
  `IgniteCheckedException` - If config is invalid.

#### dumpStatistics

    public void dumpStatistics(IgniteLogger log)

Parameters:
  `log` - Logger.

#### initDataBase

    public void initDataBase()
                      throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If failed.

#### memoryPolicies

    public Collection<MemoryPolicy> memoryPolicies()

Returns:
  collection of all configured `policies`.

#### memoryMetrics

    public Collection<MemoryMetrics> memoryMetrics()

Returns:
  MemoryMetrics for all MemoryPolicies configured in Ignite instance.

#### memoryPolicy

    public MemoryPolicy memoryPolicy(String memPlcName)
                              throws IgniteCheckedException

Parameters:
  `memPlcName` - Memory policy name.
Returns:
  `MemoryPolicy` instance associated with a given `MemoryPolicyConfiguration`.
Throws:
  `IgniteCheckedException` - in case of request for unknown MemoryPolicy.

#### freeList

    public FreeList freeList(String memPlcName)

Parameters:
  `memPlcName` - MemoryPolicyConfiguration name.
Returns:
  `FreeList` instance associated with a given `MemoryPolicyConfiguration`.

#### reuseList

    public ReuseList reuseList(String memPlcName)

Parameters:
  `memPlcName` - MemoryPolicyConfiguration name.
Returns:
  `ReuseList` instance associated with a given `MemoryPolicyConfiguration`.

#### stop0

    protected void stop0(boolean cancel)

Overrides:
  `stop0` in class `GridCacheSharedManagerAdapter`
Parameters:
  `cancel` - Cancel flag.

#### persistenceEnabled

    public boolean persistenceEnabled()

#### lock

    public void lock()
              throws IgniteCheckedException

Throws:
  `IgniteCheckedException`

#### unLock

    public void unLock()

#### checkpointReadLock

    public void checkpointReadLock()

No-op for non-persistent storage.

#### checkpointReadUnlock

    public void checkpointReadUnlock()

No-op for non-persistent storage.

#### wakeupForCheckpoint

    @Nullable
    public IgniteInternalFuture wakeupForCheckpoint(String reason)

#### waitForCheckpoint

    public void waitForCheckpoint(String reason)
                           throws IgniteCheckedException

Waits until current state is checkpointed.

Throws:
  `IgniteCheckedException` - If failed.

#### wakeupForSnapshot

    @Nullable
    public IgniteInternalFuture wakeupForSnapshot(long snapshotId,
                                                  UUID snapshotNodeId,
                                                  Collection<String> cacheNames)

#### beforeExchange

    public void beforeExchange(GridDhtPartitionsExchangeFuture discoEvt)
                        throws IgniteCheckedException

Parameters:
  `discoEvt` - Before exchange for the given discovery event.
Throws:
  `IgniteCheckedException`

#### beforeCachesStop

    public void beforeCachesStop()
                          throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If failed.

#### onCacheStop

    public void onCacheStop(GridCacheContext cctx)

Parameters:
  `cctx` - Stopped cache context.

#### startLocalSnapshotCreation

    @Nullable
    public IgniteInternalFuture startLocalSnapshotCreation(StartFullSnapshotAckDiscoveryMessage snapshotMsg,
                                                           ClusterNode initiator,
                                                           String msg)
                                                    throws IgniteCheckedException

Parameters:
  `snapshotMsg` - Snapshot message.
  `initiator` - Initiator node.
  `msg` - message to log
Returns:
  Snapshot creation init future or `null` if snapshot is not available.
Throws:
  `IgniteCheckedException` - If failed.

#### indexRebuildFuture

    @Nullable
    public IgniteInternalFuture indexRebuildFuture(int cacheId)

Returns:
  Future that will be completed when indexes for given cache are restored.

#### ensureFreeSpace

    public void ensureFreeSpace(MemoryPolicy memPlc)
                         throws IgniteCheckedException

See `GridCacheMapEntry.ensureFreeSpace()`

Parameters:
  `memPlc` - Memory policy.
Throws:
  `IgniteCheckedException`

#### buildAllocPath

    @Nullable
    protected File buildAllocPath(MemoryPolicyConfiguration plc)

Builds allocation path for memory mapped file to be used with PageMemory.

Parameters:
  `plc` - MemoryPolicyConfiguration.

#### createPageMemory

    protected PageMemory createPageMemory(DirectMemoryProvider memProvider,
                              MemoryConfiguration memCfg,
                              MemoryPolicyConfiguration memPlcCfg,
                              MemoryMetricsImpl memMetrics)

Creates PageMemory with given size and memory provider.

Parameters:
  `memProvider` - Memory provider.
  `memCfg` - Memory configuartion.
  `memPlcCfg` - Memory policy configuration.
  `memMetrics` - MemoryMetrics to collect memory usage metrics.
Returns:
  PageMemory instance.

#### buildPath

    protected File buildPath(String path,
                 String consId)

Parameters:
  `path` - Path to the working directory.
  `consId` - Consistent ID of the local node.
Returns:
  DB storage path.

#### onActivate

    public void onActivate(GridKernalContext kctx)
                    throws IgniteCheckedException

Called when cluster performing activation.

Specified by:
  `onActivate` in interface `IgniteChangeGlobalStateSupport`
Parameters:
  `kctx` - Kernal context.
Throws:
  `IgniteCheckedException` - If failed.

#### onDeActivate

    public void onDeActivate(GridKernalContext kctx)
                      throws IgniteCheckedException

Called when cluster performing deactivation.

Specified by:
  `onDeActivate` in interface `IgniteChangeGlobalStateSupport`
Parameters:
  `kctx` - Kernal context.
Throws:
  `IgniteCheckedException` - If failed.

#### systemMemoryPolicyName

    public String systemMemoryPolicyName()

Returns:
  Name of MemoryPolicyConfiguration for internal caches.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

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