 |
GridGain C++
|
Go to the documentation of this file.
22 #ifndef _IGNITE_CACHE_AFFINITY
23 #define _IGNITE_CACHE_AFFINITY
27 #include <ignite/impl/cache/cache_affinity_impl.h>
62 return impl.Get()->GetPartitions();
73 return impl.Get()->GetPartition(key);
85 return impl.Get()->IsPrimary(node, key);
97 return impl.Get()->IsBackup(node, key);
112 return impl.Get()->IsPrimaryOrBackup(node, key);
123 return impl.Get()->GetPrimaryPartitions(node);
134 return impl.Get()->GetBackupPartitions(node);
145 return impl.Get()->GetAllPartitions(node);
156 template <
typename TR>
159 return impl.Get()->template GetAffinityKey<K, TR>(key);
170 std::map<cluster::ClusterNode, std::vector<K> >
MapKeysToNodes(
const std::vector<K>& keys)
172 return impl.Get()->MapKeysToNodes(keys);
185 return impl.Get()->MapKeyToNode(key);
197 return impl.Get()->MapKeyToPrimaryAndBackups(key);
208 return impl.Get()->MapPartitionToNode(part);
219 return impl.Get()->MapPartitionsToNodes(parts);
231 return impl.Get()->MapPartitionToPrimaryAndBackups(part);
235 impl::cache::SP_CacheAffinityImpl impl;
240 #endif //_IGNITE_CACHE_AFFINITY
bool IsBackup(cluster::ClusterNode node, const K &key)
Return true if local node is one of the backup nodes for given key.
Definition: cache_affinity.h:95
Ignite API.
Definition: cache.h:47
std::vector< int32_t > GetAllPartitions(cluster::ClusterNode node)
Get partition ids for which given cluster node has any ownership (either primary or backup).
Definition: cache_affinity.h:143
bool IsPrimary(cluster::ClusterNode node, const K &key)
Return true if given node is the primary node for given key.
Definition: cache_affinity.h:83
std::vector< int32_t > GetPrimaryPartitions(cluster::ClusterNode node)
Get partition ids for which the given cluster node has primary ownership.
Definition: cache_affinity.h:121
std::vector< cluster::ClusterNode > MapKeyToPrimaryAndBackups(const K &key)
Get primary and backup nodes for the key.
Definition: cache_affinity.h:195
int32_t GetPartition(const K &key)
Get partition id for the given key.
Definition: cache_affinity.h:71
std::vector< int32_t > GetBackupPartitions(cluster::ClusterNode node)
Get partition ids for which given cluster node has backup ownership.
Definition: cache_affinity.h:132
std::vector< cluster::ClusterNode > MapPartitionToPrimaryAndBackups(int32_t part)
Get primary and backup nodes for partition.
Definition: cache_affinity.h:229
int32_t GetPartitions()
Get number of partitions in cache according to configured affinity function.
Definition: cache_affinity.h:60
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.
Definition: cache_affinity.h:170
Provides affinity information to detect which node is primary and which nodes are backups for a parti...
Definition: cache_affinity.h:41
cluster::ClusterNode MapPartitionToNode(int32_t part)
Get primary node for the given partition.
Definition: cache_affinity.h:206
TR GetAffinityKey(const K &key)
Map passed in key to a key which will be used for node affinity.
Definition: cache_affinity.h:157
bool IsPrimaryOrBackup(cluster::ClusterNode node, const K &key)
Returns true if local node is primary or one of the backup nodes.
Definition: cache_affinity.h:110
CacheAffinity(impl::cache::SP_CacheAffinityImpl impl)
Constructor.
Definition: cache_affinity.h:49
std::map< int32_t, cluster::ClusterNode > MapPartitionsToNodes(const std::vector< int32_t > &parts)
Get primary nodes for the given partitions.
Definition: cache_affinity.h:217
Interface representing a single cluster node.
Definition: cluster_node.h:35
cluster::ClusterNode MapKeyToNode(const K &key)
This method provides ability to detect to which primary node the given key is mapped.
Definition: cache_affinity.h:183