![]() |
GridGain C++
|
Provides affinity information to detect which node is primary and which nodes are backups for a partitioned or replicated cache. More...
#include <cache_affinity.h>
Public Member Functions | |
CacheAffinity (impl::cache::SP_CacheAffinityImpl impl) | |
Constructor. More... | |
int32_t | GetPartitions () |
Get number of partitions in cache according to configured affinity function. More... | |
int32_t | GetPartition (const K &key) |
Get partition id for the given key. More... | |
bool | IsPrimary (cluster::ClusterNode node, const K &key) |
Return true if given node is the primary node for given key. More... | |
bool | IsBackup (cluster::ClusterNode node, const K &key) |
Return true if local node is one of the backup nodes for given key. More... | |
bool | IsPrimaryOrBackup (cluster::ClusterNode node, const K &key) |
Returns true if local node is primary or one of the backup nodes. More... | |
std::vector< int32_t > | GetPrimaryPartitions (cluster::ClusterNode node) |
Get partition ids for which the given cluster node has primary ownership. More... | |
std::vector< int32_t > | GetBackupPartitions (cluster::ClusterNode node) |
Get partition ids for which given cluster node has backup ownership. More... | |
std::vector< int32_t > | GetAllPartitions (cluster::ClusterNode node) |
Get partition ids for which given cluster node has any ownership (either primary or backup). More... | |
template<typename TR > | |
TR | GetAffinityKey (const K &key) |
Map passed in key to a key which will be used for node affinity. More... | |
std::map< cluster::ClusterNode, std::vector< K > > | MapKeysToNodes (const std::vector< K > &keys) |
This method provides ability to detect which keys are mapped to which nodes. More... | |
cluster::ClusterNode | MapKeyToNode (const K &key) |
This method provides ability to detect to which primary node the given key is mapped. More... | |
std::vector< cluster::ClusterNode > | MapKeyToPrimaryAndBackups (const K &key) |
Get primary and backup nodes for the key. More... | |
cluster::ClusterNode | MapPartitionToNode (int32_t part) |
Get primary node for the given partition. More... | |
std::map< int32_t, cluster::ClusterNode > | MapPartitionsToNodes (const std::vector< int32_t > &parts) |
Get primary nodes for the given partitions. More... | |
std::vector< cluster::ClusterNode > | MapPartitionToPrimaryAndBackups (int32_t part) |
Get primary and backup nodes for partition. More... | |
Provides affinity information to detect which node is primary and which nodes are backups for a partitioned or replicated cache.
You can get an instance of this interface by calling Ignite.GetAffinity(cacheName) method.
K | Cache affinity key type. |
|
inline |
Constructor.
impl | Pointer to cache affinity implementation. |
|
inline |
Map passed in key to a key which will be used for node affinity.
TR | Key to be used for node-to-affinity mapping type. |
key | Key to map. |
|
inline |
Get partition ids for which given cluster node has any ownership (either primary or backup).
node | Cluster node. |
|
inline |
Get partition ids for which given cluster node has backup ownership.
node | Cluster node. |
|
inline |
Get partition id for the given key.
key | Key to get partition id for. |
|
inline |
Get number of partitions in cache according to configured affinity function.
|
inline |
Get partition ids for which the given cluster node has primary ownership.
node | Cluster node. |
|
inline |
Return true if local node is one of the backup nodes for given key.
node | Cluster node. |
key | Key to check. |
|
inline |
Return true if given node is the primary node for given key.
node | Cluster node. |
key | Key to check. |
|
inline |
Returns true if local node is primary or one of the backup nodes.
This method is essentially equivalent to calling "isPrimary(ClusterNode, Object) || isBackup(ClusterNode, Object))", however it is more efficient as it makes both checks at once.
node | Cluster node. |
key | Key to check. |
|
inline |
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.
keys | Keys to map to nodes. |
|
inline |
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.
key | Key to map to node. |
|
inline |
Get primary and backup nodes for the key.
Note that primary node is always first in the returned collection.
key | Key to map to nodes. |
|
inline |
Get primary nodes for the given partitions.
parts | Partition ids. |
|
inline |
Get primary node for the given partition.
part | Partition id. |
|
inline |
Get primary and backup nodes for partition.
Note that primary node is always first in the returned collection.
part | Partition to get affinity nodes for. |