Search in sources :

Example 16 with IgfsMode

use of org.apache.ignite.igfs.IgfsMode in project ignite by apache.

the class IgfsCachePerBlockLruEvictionPolicySelfTest method startPrimary.

/**
     * Start a grid with the primary file system.
     *
     * @throws Exception If failed.
     */
private void startPrimary() throws Exception {
    FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
    igfsCfg.setName(IGFS_PRIMARY);
    igfsCfg.setBlockSize(512);
    igfsCfg.setDefaultMode(DUAL_SYNC);
    igfsCfg.setPrefetchBlocks(1);
    igfsCfg.setSequentialReadsBeforePrefetch(Integer.MAX_VALUE);
    igfsCfg.setSecondaryFileSystem(secondaryFs.asSecondary());
    Map<String, IgfsMode> pathModes = new HashMap<>();
    pathModes.put(FILE.toString(), PRIMARY);
    igfsCfg.setPathModes(pathModes);
    CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
    dataCacheCfg.setCacheMode(PARTITIONED);
    dataCacheCfg.setNearConfiguration(null);
    dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
    evictPlc = new IgfsPerBlockLruEvictionPolicy();
    dataCacheCfg.setEvictionPolicy(evictPlc);
    dataCacheCfg.setOnheapCacheEnabled(true);
    dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
    dataCacheCfg.setBackups(0);
    CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
    metaCacheCfg.setCacheMode(REPLICATED);
    metaCacheCfg.setNearConfiguration(null);
    metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
    igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
    igfsCfg.setDataCacheConfiguration(dataCacheCfg);
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setIgniteInstanceName("grid-primary");
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    cfg.setDiscoverySpi(discoSpi);
    cfg.setFileSystemConfiguration(igfsCfg);
    cfg.setLocalHost("127.0.0.1");
    cfg.setConnectorConfiguration(null);
    Ignite g = G.start(cfg);
    igfsPrimary = (IgfsImpl) g.fileSystem(IGFS_PRIMARY);
    dataCache = igfsPrimary.context().kernalContext().cache().internalCache(igfsPrimary.context().configuration().getDataCacheConfiguration().getName());
}
Also used : IgfsPerBlockLruEvictionPolicy(org.apache.ignite.cache.eviction.igfs.IgfsPerBlockLruEvictionPolicy) IgfsMode(org.apache.ignite.igfs.IgfsMode) IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) HashMap(java.util.HashMap) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) Ignite(org.apache.ignite.Ignite) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

IgfsMode (org.apache.ignite.igfs.IgfsMode)16 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)8 HashMap (java.util.HashMap)6 IgniteException (org.apache.ignite.IgniteException)5 IgfsException (org.apache.ignite.igfs.IgfsException)5 IgfsInvalidPathException (org.apache.ignite.igfs.IgfsInvalidPathException)5 IgfsPathIsDirectoryException (org.apache.ignite.igfs.IgfsPathIsDirectoryException)5 IgfsPathNotFoundException (org.apache.ignite.igfs.IgfsPathNotFoundException)5 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)4 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)4 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)4 IgfsPath (org.apache.ignite.igfs.IgfsPath)4 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)3 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)3 HashSet (java.util.HashSet)2 Map (java.util.Map)2 IgfsFile (org.apache.ignite.igfs.IgfsFile)2 IgfsIpcEndpointConfiguration (org.apache.ignite.igfs.IgfsIpcEndpointConfiguration)2 T2 (org.apache.ignite.internal.util.typedef.T2)2 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)2