Search in sources :

Example 96 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteCacheFullTextQueryNodeJoiningSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    CacheConfiguration cache = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cache.setCacheMode(PARTITIONED);
    cache.setAtomicityMode(atomicityMode());
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setBackups(1);
    QueryEntity qryEntity = new QueryEntity();
    qryEntity.setKeyType(AffinityKey.class.getName());
    qryEntity.setValueType(IndexedEntity.class.getName());
    LinkedHashMap<String, String> fields = new LinkedHashMap<>();
    fields.put("val", String.class.getName());
    qryEntity.setFields(fields);
    qryEntity.setIndexes(Arrays.asList(new QueryIndex("val", QueryIndexType.FULLTEXT)));
    cache.setQueryEntities(Arrays.asList(qryEntity));
    cfg.setCacheConfiguration(cache);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
    commSpi.setSharedMemoryPort(-1);
    cfg.setCommunicationSpi(commSpi);
    cfg.setDiscoverySpi(disco);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) QueryIndex(org.apache.ignite.cache.QueryIndex) QueryEntity(org.apache.ignite.cache.QueryEntity) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) AffinityKey(org.apache.ignite.cache.affinity.AffinityKey) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) LinkedHashMap(java.util.LinkedHashMap) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 97 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteCacheDistributedJoinTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi spi = ((TcpDiscoverySpi) cfg.getDiscoverySpi());
    spi.setIpFinder(IP_FINDER);
    CacheConfiguration<Integer, A> ccfga = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
    ccfga.setName("a");
    ccfga.setSqlSchema("A");
    ccfga.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfga.setBackups(1);
    ccfga.setCacheMode(CacheMode.PARTITIONED);
    ccfga.setIndexedTypes(Integer.class, A.class);
    CacheConfiguration<Integer, B> ccfgb = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
    ccfgb.setName("b");
    ccfgb.setSqlSchema("B");
    ccfgb.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfgb.setBackups(1);
    ccfgb.setCacheMode(CacheMode.PARTITIONED);
    ccfgb.setIndexedTypes(Integer.class, B.class);
    CacheConfiguration<Integer, C> ccfgc = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
    ccfgc.setName("c");
    ccfgc.setSqlSchema("C");
    ccfgc.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfgc.setBackups(1);
    ccfgc.setCacheMode(CacheMode.PARTITIONED);
    ccfgc.setIndexedTypes(Integer.class, C.class);
    cfg.setCacheConfiguration(ccfga, ccfgb, ccfgc);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 98 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteCacheLockPartitionOnAffinityRunAbstractTest method createCacheWithAffinity.

/**
     * @param cacheName Cache name.
     * @throws Exception If failed.
     */
private void createCacheWithAffinity(String cacheName) throws Exception {
    CacheConfiguration ccfg = cacheConfiguration(grid(0).name());
    ccfg.setName(cacheName);
    ccfg.setAffinity(new DummyAffinity());
    grid(0).createCache(ccfg);
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 99 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration 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);
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 100 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest method cacheConfiguration.

/** {@inheritDoc} */
@Override
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
    ccfg.setBackups(0);
    return ccfg;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)980 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)392 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)287 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)250 Ignite (org.apache.ignite.Ignite)148 ArrayList (java.util.ArrayList)69 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)64 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)59 QueryEntity (org.apache.ignite.cache.QueryEntity)44 IgniteException (org.apache.ignite.IgniteException)43 CacheException (javax.cache.CacheException)42 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)40 IgniteEx (org.apache.ignite.internal.IgniteEx)40 IgniteCache (org.apache.ignite.IgniteCache)39 LinkedHashMap (java.util.LinkedHashMap)35 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)34 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)32 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)30 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)30 Transaction (org.apache.ignite.transactions.Transaction)28