use of org.apache.ignite.internal.sql.optimizer.affinity.PartitionAffinityFunctionType in project ignite by apache.
the class PartitionExtractor method affinityForCache.
/**
* Prepare affinity identifier for cache.
*
* @param ccfg Cache configuration.
* @return Affinity identifier.
*/
private static PartitionTableAffinityDescriptor affinityForCache(CacheConfiguration ccfg) {
// Partition could be extracted only from PARTITIONED caches.
if (ccfg.getCacheMode() != CacheMode.PARTITIONED)
return null;
PartitionAffinityFunctionType aff = ccfg.getAffinity().getClass().equals(RendezvousAffinityFunction.class) ? PartitionAffinityFunctionType.RENDEZVOUS : PartitionAffinityFunctionType.CUSTOM;
boolean hasNodeFilter = ccfg.getNodeFilter() != null && !(ccfg.getNodeFilter() instanceof CacheConfiguration.IgniteAllNodesPredicate);
return new PartitionTableAffinityDescriptor(aff, ccfg.getAffinity().partitions(), hasNodeFilter, ccfg.getDataRegionName());
}
Aggregations