use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgniteCacheReadThroughStoreCallTest method cacheConfiguration.
/**
* @param cacheMode Cache mode.
* @param atomicityMode Atomicity mode.
* @param backups Number of backups.
* @return Cache configuration.
*/
@SuppressWarnings("unchecked")
protected CacheConfiguration<Object, Object> cacheConfiguration(CacheMode cacheMode, CacheAtomicityMode atomicityMode, int backups) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
ccfg.setCacheStoreFactory(new TestStoreFactory());
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setAtomicityMode(atomicityMode);
ccfg.setCacheMode(cacheMode);
ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
if (cacheMode == PARTITIONED)
ccfg.setBackups(backups);
return ccfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgniteClientAffinityAssignmentSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
if (cache) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfg.setBackups(1);
ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
ccfg.setNearConfiguration(null);
ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));
cfg.setCacheConfiguration(ccfg);
} else
cfg.setClientMode(true);
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest method createCache.
/**
* @param cacheName Cache name.
* @param mode Atomicity mode.
* @throws Exception If failed.
*/
private void createCache(String cacheName, CacheAtomicityMode mode) throws Exception {
CacheConfiguration ccfg = cacheConfiguration(grid(0).name());
ccfg.setName(cacheName);
ccfg.setAtomicityMode(mode);
ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT));
grid(0).createCache(ccfg);
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class AffinityHistoryCleanupTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
CacheConfiguration[] ccfgs = new CacheConfiguration[4];
for (int i = 0; i < ccfgs.length; i++) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setName("static-cache-" + i);
ccfg.setAffinity(new RendezvousAffinityFunction());
ccfgs[i] = ccfg;
}
cfg.setCacheConfiguration(ccfgs);
cfg.setClientMode(client);
cfg.setLateAffinityAssignment(lateAffAssignment);
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class LocalAffinityFunctionTest method getConfiguration.
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setBackups(1);
ccfg.setName(CACHE1);
ccfg.setCacheMode(CacheMode.LOCAL);
ccfg.setAffinity(new RendezvousAffinityFunction());
cfg.setCacheConfiguration(ccfg);
return cfg;
}
Aggregations