Search in sources :

Example 36 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class SVMMultiClassClassificationExample method getTestCache.

/**
 * Fills cache with data and returns it.
 *
 * @param ignite Ignite instance.
 * @return Filled Ignite Cache.
 */
private static IgniteCache<Integer, double[]> getTestCache(Ignite ignite) {
    CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
    cacheConfiguration.setName("TEST_" + UUID.randomUUID());
    cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
    IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
    for (int i = 0; i < data.length; i++) cache.put(i, data[i]);
    return cache;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 37 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class DistributedLinearRegressionWithLSQRTrainerAndNormalizationExample method getTestCache.

/**
 * Fills cache with data and returns it.
 *
 * @param ignite Ignite instance.
 * @return Filled Ignite Cache.
 */
private static IgniteCache<Integer, double[]> getTestCache(Ignite ignite) {
    CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
    cacheConfiguration.setName("TEST_" + UUID.randomUUID());
    cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
    IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
    for (int i = 0; i < data.length; i++) cache.put(i, data[i]);
    return cache;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 38 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class SVMBinaryClassificationExample method getTestCache.

/**
 * Fills cache with data and returns it.
 *
 * @param ignite Ignite instance.
 * @return Filled Ignite Cache.
 */
private static IgniteCache<Integer, double[]> getTestCache(Ignite ignite) {
    CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
    cacheConfiguration.setName("TEST_" + UUID.randomUUID());
    cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
    IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
    for (int i = 0; i < data.length; i++) cache.put(i, data[i]);
    return cache;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 39 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class GridCacheLeakTest method cacheConfiguration.

/**
 * Gets cache configuration.
 *
 * @return Data cache configuration.
 */
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cfg = defaultCacheConfiguration();
    cfg.setName(CACHE_NAME);
    cfg.setAffinity(new RendezvousAffinityFunction(false, 128));
    cfg.setCacheMode(PARTITIONED);
    cfg.setBackups(1);
    cfg.setNearConfiguration(null);
    cfg.setWriteSynchronizationMode(FULL_SYNC);
    cfg.setAtomicityMode(atomicityMode);
    return cfg;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 40 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class IgniteCacheGroupsPartitionLossPolicySelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
    cfg.setClientMode(client);
    CacheConfiguration ccfg1 = new CacheConfiguration(CACHE_1).setGroupName(GROUP_NAME).setCacheMode(PARTITIONED).setBackups(0).setWriteSynchronizationMode(FULL_SYNC).setPartitionLossPolicy(partLossPlc).setAffinity(new RendezvousAffinityFunction(false, 32));
    CacheConfiguration ccfg2 = new CacheConfiguration(ccfg1).setName(CACHE_2);
    cfg.setCacheConfiguration(ccfg1, ccfg2);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)142 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)126 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)71 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)48 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)33 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)33 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)11 Ignite (org.apache.ignite.Ignite)11 IgniteEx (org.apache.ignite.internal.IgniteEx)11 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)10 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)10 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)8 AffinityFunction (org.apache.ignite.cache.affinity.AffinityFunction)8 ArrayList (java.util.ArrayList)7 Random (java.util.Random)7 IgniteCache (org.apache.ignite.IgniteCache)7 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)7 QueryEntity (org.apache.ignite.cache.QueryEntity)4 Transaction (org.apache.ignite.transactions.Transaction)4 GridCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager)3