/** * @param g Grid. * @return Near cache. */ @SuppressWarnings({"unchecked"}) private GridNearCacheAdapter<Integer, String> near(Ignite g) { return (GridNearCacheAdapter)((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME); }
/** * @param g Grid. * @return Near cache. */ private static GridNearCacheAdapter<String, Integer> near(Ignite g) { return (GridNearCacheAdapter<String, Integer>)((IgniteKernal)g).<String, Integer>internalCache(DEFAULT_CACHE_NAME); }
/** * @param idx Grid index. * @return Cache. */ protected <K, V> GridCacheAdapter<K, V> internalCache(int idx) { return ((IgniteKernal)grid(idx)).internalCache(DEFAULT_CACHE_NAME); }
/** * @param g Grid. * @return Dht cache. */ @SuppressWarnings({"unchecked"}) private GridDhtCacheAdapter<Integer, String> dht(Ignite g) { return ((GridNearCacheAdapter)((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME)).dht(); }
/** * @param g Grid. * @return Dht cache. */ @SuppressWarnings({"unchecked"}) private GridDhtCacheAdapter<Integer, String> dht(Ignite g) { return ((GridNearCacheAdapter)((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME)).dht(); }
/** * @param cache Cache. * @return Cache. */ protected static <K, V> GridCacheAdapter<K, V> internalCache0(IgniteCache<K, V> cache) { if (isMultiJvmObject(cache)) throw new UnsupportedOperationException("Operation can't be supported automatically for multi jvm " + "(send closure instead)."); return ((IgniteKernal)cache.unwrap(Ignite.class)).internalCache(cache.getName()); }
/** * @param cache Cache. * @return Cache context. */ public static <K, V> GridCacheContext<K, V> cacheContext(IgniteCache<K, V> cache) { return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context(); }
/** * @param nodeId Node ID. * @param key Key. * @return Near entry. */ @Nullable private static GridCacheEntryEx nearEntry(UUID nodeId, Object key) { Ignite g = G.ignite(nodeId); GridNearCacheAdapter<Object, Integer> near = ((IgniteKernal)g).<Object, Integer>internalCache(DEFAULT_CACHE_NAME).context().near(); return near.peekEx(key); }
/** * @param idx Index of grid. * @return Cache context. */ protected GridCacheContext<String, Integer> context(final int idx) { if (isRemoteJvm(idx) && !isRemoteJvm()) throw new UnsupportedOperationException("Operation can't be done automatically via proxy. " + "Send task with this logic on remote jvm instead."); return ((IgniteKernal)grid(idx)).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context(); }
/** * @param idx Grid index. * @param cache Cache name. * @return Near cache. */ protected <K, V> GridNearCacheAdapter<K, V> near(int idx, String cache) { return ((IgniteKernal)grid(idx)).<K, V>internalCache(cache).context().near(); }
/** * @return Affinity. */ private AffinityFunction affinity() { return ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME).configuration().getAffinity(); }
/** * @return Affinity mapper. */ private AffinityKeyMapper affinityMapper() { return ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME).configuration().getAffinityMapper(); }
/** * @param idx Index of grid. * @return Cache context. */ protected GridCacheContext<String, Integer> context(final int idx) { if (isRemoteJvm(idx) && !isRemoteJvm()) throw new UnsupportedOperationException("Operation can't be done automatically via proxy. " + "Send task with this logic on remote jvm instead."); return ((IgniteKernal)grid(idx)).<String, Integer>internalCache(cacheName()).context(); }
/** * @throws Exception If failed. */ @Test public void testPutAndRollbackCheckDht() throws Exception { doPutAndRollback(); GridCacheAdapter<Integer, Integer> c = ((GridNearCacheAdapter<Integer, Integer>)((IgniteKernal)grid()).internalCache(DEFAULT_CACHE_NAME).<Integer, Integer>cache()).dht(); assert c.entrySet().isEmpty() : "Actual size: " + c.entrySet().size(); }
/** * Get data cache for node. * * @param node Node. * @return Data cache. * @throws Exception If failed. */ private GridCacheAdapter dataCache(Ignite node) throws Exception { return ((IgniteKernal)node).internalCache(((IgniteKernal)node).igfsx(IGFS_NAME).configuration() .getDataCacheConfiguration().getName()); }
/** {@inheritDoc} */ @Override public void run(int idx) throws Exception { GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(cacheName).context(); int size = 0; for (String key : map.keySet()) if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx())) size++; assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(ctx.name()).localSize(ALL)); } }
/** {@inheritDoc} */ @Override public void run(int idx) throws Exception { GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context(); int size = 0; for (String key : keys) if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx())) size++; assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(DEFAULT_CACHE_NAME).localSize(ALL)); } }
/** * Gets the data cache instance for this IGFS instance. * * @param igfs The IGFS unstance. * @return The data cache. */ protected static GridCacheAdapter<IgfsBlockKey, byte[]> getDataCache(IgniteFileSystem igfs) { String dataCacheName = igfs.configuration().getDataCacheConfiguration().getName(); IgniteEx igniteEx = ((IgfsEx)igfs).context().kernalContext().grid(); return ((IgniteKernal)igniteEx).internalCache(dataCacheName); }
/** * @param idx Grid index. * @return DHT cache. */ protected <K, V> GridDhtCacheAdapter<K, V> dht(int idx) { GridCacheAdapter<K, V> internalCache = ((IgniteKernal)grid(idx)).internalCache(DEFAULT_CACHE_NAME); return internalCache.isNear() ? internalCache.context().near().dht() : internalCache.context().dht(); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { IgniteEx grid = grid(0); igfs = grid.fileSystem(igfsName()); FileSystemConfiguration[] cfgs = grid.configuration().getFileSystemConfiguration(); assert cfgs.length == 1; metaCacheName = cfgs[0].getMetaCacheConfiguration().getName(); metaCache = ((IgniteKernal)grid).internalCache(metaCacheName); }