Apache Ignite.NET
|
Provides affinity information to detect which node is primary and which nodes are backups for a partitioned cache. You can get an instance of this interface by calling IIgnite.GetAffinity method. More...
Public Member Functions | |
int | GetPartition< TK > (TK key) |
Gets partition id for the given key. More... | |
bool | IsPrimary< TK > (IClusterNode n, TK key) |
Returns 'true' if given node is the primary node for given key. More... | |
bool | IsBackup< TK > (IClusterNode n, TK key) |
Returns 'true' if given node is the backup node for given key. More... | |
bool | IsPrimaryOrBackup< TK > (IClusterNode n, TK key) |
Returns 'true' if given node is either primary or backup node for given key. More... | |
int[] | GetPrimaryPartitions (IClusterNode n) |
Gets partition ids for which nodes of the given projection has primary ownership. More... | |
int[] | GetBackupPartitions (IClusterNode n) |
Gets partition ids for which nodes of the given projection has backup ownership. More... | |
int[] | GetAllPartitions (IClusterNode n) |
Gets partition ids for which nodes of the given projection has ownership (either primary or backup). More... | |
TR | GetAffinityKey< TK, TR > (TK key) |
Maps passed in key to a key which will be used for node affinity. More... | |
IDictionary< IClusterNode, IList< TK > > | MapKeysToNodes< TK > (IEnumerable< TK > keys) |
This method provides ability to detect which keys are mapped to which nodes. Use it to determine which nodes are storing which keys prior to sending jobs that access these keys. More... | |
IClusterNode | MapKeyToNode< TK > (TK key) |
This method provides ability to detect to which primary node the given key is mapped. Use it to determine which nodes are storing which keys prior to sending jobs that access these keys. More... | |
IList< IClusterNode > | MapKeyToPrimaryAndBackups< TK > (TK key) |
Gets primary and backup nodes for the key. Note that primary node is always first in the returned collection. More... | |
IClusterNode | MapPartitionToNode (int part) |
Gets primary node for the given partition. More... | |
IDictionary< int, IClusterNode > | MapPartitionsToNodes (IEnumerable< int > parts) |
Gets primary nodes for the given partitions. More... | |
IList< IClusterNode > | MapPartitionToPrimaryAndBackups (int part) |
Gets primary and backup nodes for partition. Note that primary node is always first in the returned collection. More... | |
Properties | |
int | Partitions [get] |
Gets number of partitions in cache according to configured affinity function. More... | |
Mapping of a key to a node is a three-step operation. First step will get an affinity key for given key using CacheAffinityKeyMapper
. If mapper is not specified, the original key will be used. Second step will map affinity key to partition using CacheAffinityFunction.partition(Object)
method. Third step will map obtained partition to nodes for current grid topology version.
Interface provides various mapKeysToNodes(...)
methods which provide node affinity mapping for given keys. All mapKeysToNodes(...)
methods are not transactional and will not enlist keys into ongoing transaction.
All members are thread-safe and may be used concurrently from multiple threads.
TR Apache.Ignite.Core.Cache.ICacheAffinity.GetAffinityKey< TK, TR > | ( | TK | key | ) |
key | Key to map. |
int [] Apache.Ignite.Core.Cache.ICacheAffinity.GetAllPartitions | ( | IClusterNode | n | ) |
n | Node. |
int [] Apache.Ignite.Core.Cache.ICacheAffinity.GetBackupPartitions | ( | IClusterNode | n | ) |
n | Node. |
int Apache.Ignite.Core.Cache.ICacheAffinity.GetPartition< TK > | ( | TK | key | ) |
key | Key to get partition id for. |
int [] Apache.Ignite.Core.Cache.ICacheAffinity.GetPrimaryPartitions | ( | IClusterNode | n | ) |
n | Node. |
bool Apache.Ignite.Core.Cache.ICacheAffinity.IsBackup< TK > | ( | IClusterNode | n, |
TK | key | ||
) |
n | Node. |
key | Key. |
bool Apache.Ignite.Core.Cache.ICacheAffinity.IsPrimary< TK > | ( | IClusterNode | n, |
TK | key | ||
) |
n | Node. |
key | Key. |
bool Apache.Ignite.Core.Cache.ICacheAffinity.IsPrimaryOrBackup< TK > | ( | IClusterNode | n, |
TK | key | ||
) |
n | Node. |
key | Key. |
IDictionary<IClusterNode, IList<TK> > Apache.Ignite.Core.Cache.ICacheAffinity.MapKeysToNodes< TK > | ( | IEnumerable< TK > | keys | ) |
keys | Keys to map to nodes. |
IClusterNode Apache.Ignite.Core.Cache.ICacheAffinity.MapKeyToNode< TK > | ( | TK | key | ) |
key | Keys to map to a node. |
IList<IClusterNode> Apache.Ignite.Core.Cache.ICacheAffinity.MapKeyToPrimaryAndBackups< TK > | ( | TK | key | ) |
key |
IDictionary<int, IClusterNode> Apache.Ignite.Core.Cache.ICacheAffinity.MapPartitionsToNodes | ( | IEnumerable< int > | parts | ) |
parts | Partition ids. |
IClusterNode Apache.Ignite.Core.Cache.ICacheAffinity.MapPartitionToNode | ( | int | part | ) |
part | Partition id. |
IList<IClusterNode> Apache.Ignite.Core.Cache.ICacheAffinity.MapPartitionToPrimaryAndBackups | ( | int | part | ) |
part | Partition to get affinity nodes for. |
|
get |