Search in sources :

Example 1 with PartitionAffinityFunctionType

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());
}
Also used : PartitionAffinityFunctionType(org.apache.ignite.internal.sql.optimizer.affinity.PartitionAffinityFunctionType) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) PartitionTableAffinityDescriptor(org.apache.ignite.internal.sql.optimizer.affinity.PartitionTableAffinityDescriptor)

Aggregations

RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 PartitionAffinityFunctionType (org.apache.ignite.internal.sql.optimizer.affinity.PartitionAffinityFunctionType)1 PartitionTableAffinityDescriptor (org.apache.ignite.internal.sql.optimizer.affinity.PartitionTableAffinityDescriptor)1