org.apache.ignite.internal.processors.cache

## Class CacheGroupContext

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.CacheGroupContext

    public class CacheGroupContext
    extends Object

### Constructor Summary

Constructors
Constructor and Description
`CacheGroupContext(GridCacheSharedContext ctx, int grpId, UUID rcvdFrom, CacheType cacheType, CacheConfiguration ccfg, boolean affNode, DataRegion dataRegion, CacheObjectContext cacheObjCtx, FreeList freeList, ReuseList reuseList, AffinityTopologyVersion locStartVer, boolean persistenceEnabled, boolean walEnabled, boolean recoveryMode)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addCacheEvent(int part, KeyCacheObject key, UUID evtNodeId, int type, @Nullable CacheObject newVal, boolean hasNewVal, @Nullable CacheObject oldVal, boolean hasOldVal, boolean keepBinary)`
`void` `addCacheWithContinuousQuery(GridCacheContext cctx)`
`void` `addRebalanceEvent(int part, int type, ClusterNode discoNode, int discoType, long discoTs)` Adds rebalancing event.
`void` `addRebalanceMissEvent(int part)` Adds partition supply event.
`void` `addRebalanceSupplyEvent(int part)` Adds partition supply event.
`void` `addUnloadEvent(int part)` Adds partition unload event.
`GridAffinityAssignmentCache` `affinity()`
`AffinityFunction` `affinityFunction()`
`boolean` `affinityNode()`
`Set<Integer>` `cacheIds()`
`CacheObjectContext` `cacheObjectContext()`
`String` `cacheOrGroupName()`
`static String` `cacheOrGroupName(CacheConfiguration<?,?> ccfg)`
`List<GridCacheContext>` `caches()`
`CacheConfiguration` `config()`
`DataRegion` `dataRegion()`
`boolean` `deploymentEnabled()`
`boolean` `eventRecordable(int type)`
`void` `finishRecovery(AffinityTopologyVersion startVer, UUID originalReceivedFrom, boolean affinityNode)` Finishes recovery for current cache group.
`FreeList` `freeList()`
`boolean` `globalWalEnabled()`
`void` `globalWalEnabled(boolean enabled)`
`int` `groupId()`
`boolean` `hasAtomicCaches()`
`boolean` `hasCache(String cacheName)`
`boolean` `hasCaches()`
`boolean` `hasContinuousQueryCaches()`
`byte` `ioPolicy()`
`boolean` `isDrEnabled()`
`boolean` `isLocal()`
`boolean` `isRecoveryMode()`
`boolean` `isReplicated()`
`boolean` `isTopologyLocked()`
`ReadWriteLock` `listenerLock()` Obtain the group listeners lock.
`AffinityTopologyVersion` `localStartVersion()`
`boolean` `localWalEnabled()` Local WAL enabled flag.
`void` `localWalEnabled(boolean enabled, boolean persist)`
`CacheGroupMetricsImpl` `metrics()`
`boolean` `mvccEnabled()`
`@Nullable String` `name()`
`IgnitePredicate<ClusterNode>` `nodeFilter()`
`IgniteCacheOffheapManager` `offheap()`
`void` `onDisconnected(IgniteFuture reconnectFut)`
`void` `onKernalStop()`
`void` `onPartitionCounterUpdate(int cacheId, int part, long cntr, AffinityTopologyVersion topVer, boolean primary)`
`void` `onPartitionEvicted(int part)`
`void` `onReconnected()`
`boolean` `persistenceEnabled()`
`GridCachePreloader` `preloader()`
`boolean` `queriesEnabled()`
`boolean` `rebalanceEnabled()`
`UUID` `receivedFrom()`
`void` `removeCacheWithContinuousQuery(GridCacheContext cctx)`
`void` `removeIOStatistic(boolean destroy)` Removes statistics metrics registries.
`ReuseList` `reuseList()`
`GridCacheSharedContext` `shared()`
`boolean` `sharedGroup()`
`GridCacheContext` `singleCacheContext()`
`void` `start()`
`IoStatisticsHolder` `statisticsHolderData()`
`IoStatisticsHolder` `statisticsHolderIdx()`
`boolean` `storeCacheIdInDataPage()`
`boolean` `systemCache()`
`GridDhtPartitionTopology` `topology()`
`@Nullable TopologyValidator` `topologyValidator()`
`String` `toString()`
`void` `unwindUndeploys()`
`boolean` `userCache()`
`boolean` `walEnabled()` WAL enabled flag.

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

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

### Constructor Detail

#### CacheGroupContext

    public CacheGroupContext(GridCacheSharedContext ctx,
                             int grpId,
                             UUID rcvdFrom,
                             CacheType cacheType,
                             CacheConfiguration ccfg,
                             boolean affNode,
                             DataRegion dataRegion,
                             CacheObjectContext cacheObjCtx,
                             FreeList freeList,
                             ReuseList reuseList,
                             AffinityTopologyVersion locStartVer,
                             boolean persistenceEnabled,
                             boolean walEnabled,
                             boolean recoveryMode)

Parameters:
  `ctx` - Context.
  `grpId` - Group ID.
  `rcvdFrom` - Node ID cache group was received from.
  `cacheType` - Cache type.
  `ccfg` - Cache configuration.
  `affNode` - Affinity node flag.
  `dataRegion` - data region.
  `cacheObjCtx` - Cache object context.
  `freeList` - Free list.
  `reuseList` - Reuse list.
  `locStartVer` - Topology version when group was started on local node.
  `persistenceEnabled` - Persistence enabled flag.
  `walEnabled` - Wal enabled flag.

### Method Detail

#### mvccEnabled

    public boolean mvccEnabled()

Returns:
  Mvcc flag.

#### systemCache

    public boolean systemCache()

Returns:
  `True` if this is cache group for one of system caches.

#### receivedFrom

    public UUID receivedFrom()

Returns:
  Node ID initiated cache group start.

#### storeCacheIdInDataPage

    public boolean storeCacheIdInDataPage()

Returns:
  `True` if cacheId should be stored in data pages.

#### deploymentEnabled

    public boolean deploymentEnabled()

Returns:
  `True` if deployment is enabled.

#### preloader

    public GridCachePreloader preloader()

Returns:
  Preloader.

#### ioPolicy

    public byte ioPolicy()

Returns:
  IO policy for the given cache group.

#### hasCache

    public boolean hasCache(String cacheName)

Parameters:
  `cacheName` - Cache name.
Returns:
  `True` if group contains cache with given name.

#### singleCacheContext

    public GridCacheContext singleCacheContext()

Returns:
  Cache context if group contains single cache.

#### unwindUndeploys

    public void unwindUndeploys()

#### eventRecordable

    public boolean eventRecordable(int type)

Parameters:
  `type` - Event type to check.
Returns:
  `True` if given event type should be recorded.

#### userCache

    public boolean userCache()

Returns:
  `True` if cache created by user.

#### addRebalanceEvent

    public void addRebalanceEvent(int part,
                                  int type,
                                  ClusterNode discoNode,
                                  int discoType,
                                  long discoTs)

Adds rebalancing event.

Parameters:
  `part` - Partition.
  `type` - Event type.
  `discoNode` - Discovery node.
  `discoType` - Discovery event type.
  `discoTs` - Discovery event timestamp.

#### addUnloadEvent

    public void addUnloadEvent(int part)

Adds partition unload event.

Parameters:
  `part` - Partition.

#### addRebalanceSupplyEvent

    public void addRebalanceSupplyEvent(int part)

Adds partition supply event.

Parameters:
  `part` - Partition.

#### addRebalanceMissEvent

    public void addRebalanceMissEvent(int part)

Adds partition supply event.

Parameters:
  `part` - Partition.

#### addCacheEvent

    public void addCacheEvent(int part,
                              KeyCacheObject key,
                              UUID evtNodeId,
                              int type,
                              @Nullable
                              @Nullable CacheObject newVal,
                              boolean hasNewVal,
                              @Nullable
                              @Nullable CacheObject oldVal,
                              boolean hasOldVal,
                              boolean keepBinary)

Parameters:
  `part` - Partition.
  `key` - Key.
  `evtNodeId` - Event node ID.
  `type` - Event type.
  `newVal` - New value.
  `hasNewVal` - Has new value flag.
  `oldVal` - Old values.
  `hasOldVal` - Has old value flag.
  `keepBinary` - Keep binary flag.

#### queriesEnabled

    public boolean queriesEnabled()

Returns:
  `True` if contains cache with query indexing enabled.

#### isDrEnabled

    public boolean isDrEnabled()

Returns:
  `True` in case replication is enabled.

#### freeList

    public FreeList freeList()

Returns:
  Free List.

#### reuseList

    public ReuseList reuseList()

Returns:
  Reuse List.

#### cacheObjectContext

    public CacheObjectContext cacheObjectContext()

Returns:
  Cache object context.

#### shared

    public GridCacheSharedContext shared()

Returns:
  Cache shared context.

#### dataRegion

    public DataRegion dataRegion()

Returns:
  data region.

#### affinityNode

    public boolean affinityNode()

Returns:
  `True` if local node is affinity node.

#### topology

    public GridDhtPartitionTopology topology()

Returns:
  Topology.

#### isTopologyLocked

    public boolean isTopologyLocked()

Returns:
  `True` if current thread holds lock on topology.

#### offheap

    public IgniteCacheOffheapManager offheap()

Returns:
  Offheap manager.

#### localStartVersion

    public AffinityTopologyVersion localStartVersion()

Returns:
  Topology version when group was started on local node.

#### isLocal

    public boolean isLocal()

Returns:
  `True` if cache is local.

#### isReplicated

    public boolean isReplicated()

Returns:
  `True` if cache is local.

#### config

    public CacheConfiguration config()

Returns:
  Cache configuration.

#### nodeFilter

    public IgnitePredicate<ClusterNode> nodeFilter()

Returns:
  Cache node filter.

#### topologyValidator

    @Nullable
    public @Nullable TopologyValidator topologyValidator()

Returns:
  Configured topology validator.

#### affinityFunction

    public AffinityFunction affinityFunction()

Returns:
  Configured affinity function.

#### affinity

    public GridAffinityAssignmentCache affinity()

Returns:
  Affinity.

#### name

    @Nullable
    public @Nullable String name()

Returns:
  Group name or `null` if group name was not specified for cache.

#### cacheOrGroupName

    public String cacheOrGroupName()

Returns:
  Group name if it is specified, otherwise cache name.

#### cacheOrGroupName

    public static String cacheOrGroupName(CacheConfiguration<?,?> ccfg)

Returns:
  Group name if it is specified, otherwise cache name.

#### groupId

    public int groupId()

Returns:
  Group ID.

#### sharedGroup

    public boolean sharedGroup()

Returns:
  `True` if group can contain multiple caches.

#### onKernalStop

    public void onKernalStop()

#### finishRecovery

    public void finishRecovery(AffinityTopologyVersion startVer,
                               UUID originalReceivedFrom,
                               boolean affinityNode)
                        throws IgniteCheckedException

Finishes recovery for current cache group. Attaches topology version and initializes I/O.

Parameters:
  `startVer` - Cache group start version.
  `originalReceivedFrom` - UUID of node that was first who initiated cache group creating. This is needed to decide should node calculate affinity locally or fetch from other nodes.
  `affinityNode` - Flag indicates, is local node affinity node or not. This may be calculated only after node joined to topology.
Throws:
  `IgniteCheckedException` - If failed.

#### isRecoveryMode

    public boolean isRecoveryMode()

Returns:
  `True` if current cache group is in recovery mode.

#### cacheIds

    public Set<Integer> cacheIds()

Returns:
  IDs of caches in this group.

#### caches

    public List<GridCacheContext> caches()

Returns:
  Caches in this group. caches is already Unmodifiable list, so we don't need to explicitly wrap it here.

#### hasCaches

    public boolean hasCaches()

Returns:
  `True` if group contains caches.

#### onPartitionEvicted

    public void onPartitionEvicted(int part)

Parameters:
  `part` - Partition ID.

#### addCacheWithContinuousQuery

    public void addCacheWithContinuousQuery(GridCacheContext cctx)

Parameters:
  `cctx` - Cache context.

#### removeCacheWithContinuousQuery

    public void removeCacheWithContinuousQuery(GridCacheContext cctx)

Parameters:
  `cctx` - Cache context.

#### listenerLock

    public ReadWriteLock listenerLock()

Obtain the group listeners lock. Write lock should be held to register/unregister listeners. Read lock should be hel for CQ listeners notification.

Returns:
  Lock for the CQ listeners.

#### onPartitionCounterUpdate

    public void onPartitionCounterUpdate(int cacheId,
                                         int part,
                                         long cntr,
                                         AffinityTopologyVersion topVer,
                                         boolean primary)

Parameters:
  `cacheId` - ID of cache initiated counter update.
  `part` - Partition number.
  `cntr` - Counter.
  `topVer` - Topology version for current operation.

#### hasContinuousQueryCaches

    public boolean hasContinuousQueryCaches()

Returns:
  `True` if there is at least one cache with registered CQ exists in this group.

#### start

    public void start()
               throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If failed.

#### persistenceEnabled

    public boolean persistenceEnabled()

Returns:
  Persistence enabled flag.

#### onDisconnected

    public void onDisconnected(IgniteFuture reconnectFut)

Parameters:
  `reconnectFut` - Reconnect future.

#### rebalanceEnabled

    public boolean rebalanceEnabled()

Returns:
  `True` if rebalance is enabled.

#### onReconnected

    public void onReconnected()

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### walEnabled

    public boolean walEnabled()

WAL enabled flag.

#### localWalEnabled

    public boolean localWalEnabled()

Local WAL enabled flag.

Returns:
  `False` if a durability (WAL logging) is disabled for a group until rebalancing has finished.

#### globalWalEnabled

    public boolean globalWalEnabled()

Returns:
  Global WAL enabled flag.

#### globalWalEnabled

    public void globalWalEnabled(boolean enabled)

Parameters:
  `enabled` - Global WAL enabled flag.

#### localWalEnabled

    public void localWalEnabled(boolean enabled,
                                boolean persist)

Parameters:
  `enabled` - Local WAL enabled flag.
  `persist` - If `true` then flag state will be persisted into metastorage.

#### statisticsHolderIdx

    public IoStatisticsHolder statisticsHolderIdx()

Returns:
  Statistics holder to track cache IO operations.

#### statisticsHolderData

    public IoStatisticsHolder statisticsHolderData()

Returns:
  Statistics holder to track cache IO operations.

#### hasAtomicCaches

    public boolean hasAtomicCaches()

Returns:
  `True` if group has atomic caches.

#### metrics

    public CacheGroupMetricsImpl metrics()

Returns:
  Metrics.

#### removeIOStatistic

    public void removeIOStatistic(boolean destroy)

Removes statistics metrics registries.

Parameters:
  `destroy` - Group destroy flag.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.11.1
Release Date | : December 20 2021