/** * Start cache rebalance. */ public void enableRebalance() { for (IgniteCacheProxy c : publicCaches()) c.rebalance(); }
/** {@inheritDoc} */ @Override public Iterable<String> getCacheNames() { kernalGateway.readLockAnyway(); try { if (kernalGateway.getState() != GridKernalState.STARTED) throw new IllegalStateException(); Collection<String> res = new ArrayList<>(); for (IgniteCache<?, ?> cache : ignite.context().cache().publicCaches()) res.add(cache.getName()); return Collections.unmodifiableCollection(res); } finally { kernalGateway.readUnlock(); } }
/** * @return Public caches. */ public Collection<IgniteCacheProxy<?, ?>> caches() { guard(); try { checkClusterState(); return ctx.cache().publicCaches(); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public GridRestRequest asRestRequest(GridRedisMessage msg) throws IgniteCheckedException { assert msg != null; GridRestCacheRequest restReq = new GridRestCacheRequest(); restReq.clientId(msg.clientId()); switch (msg.command()) { case FLUSHDB: restReq.command(CACHE_REMOVE_ALL); restReq.cacheName(msg.cacheName()); break; default: // CACHE_CLEAR Map<Object, Object> redisCaches = new HashMap<>(); for (IgniteCacheProxy<?, ?> cache : ctx.cache().publicCaches()) { if (cache.getName().startsWith(CACHE_NAME_PREFIX)) { redisCaches.put(cache.getName(), null); } } if (redisCaches.isEmpty()) throw new GridRedisGenericException("No Redis caches found"); restReq.command(CACHE_CLEAR); restReq.values(redisCaches); } return restReq; }
IgniteCacheProxy<?, ?> pubCache = F.first(ignite.context().cache().publicCaches());
Collection<IgniteCacheProxy<?, ?>> publicCaches = grid(0).context().cache().publicCaches();
assertEquals(grid(0).context().cache().publicCaches().size(), caches.size());
/** * @throws Exception If failed. */ @Test public void testMetadataLocal() throws Exception { IgniteCacheProxy<?, ?> cache = F.first(grid(0).context().cache().publicCaches()); assertNotNull("Should have configured public cache!", cache); Collection<GridCacheSqlMetadata> metas = cache.context().queries().sqlMetadata(); // TODO: IGNITE-7740 uncomment after IGNITE-7740 will be fixed. // int cachesCnt = grid(0).cacheNames().size(); // assertEquals(cachesCnt, metas.size()); String ret = content("", GridRestCommand.CACHE_METADATA); info("Cache metadata: " + ret); JsonNode arrRes = validateJsonResponse(ret); // TODO: IGNITE-7740 uncomment after IGNITE-7740 will be fixed. // assertEquals(cachesCnt, arrRes.size()); testMetadata(metas, arrRes); Collection<GridCacheSqlMetadata> dfltCacheMeta = cache.context().queries().sqlMetadata(); ret = content(DEFAULT_CACHE_NAME, GridRestCommand.CACHE_METADATA); info("Cache metadata: " + ret); arrRes = validateJsonResponse(ret); assertEquals(1, arrRes.size()); testMetadata(dfltCacheMeta, arrRes); assertResponseContainsError(content("nonExistingCacheName", GridRestCommand.CACHE_METADATA), "Failed to request meta data. nonExistingCacheName is not found"); }
/** * Start cache rebalance. */ public void enableRebalance() { for (IgniteCacheProxy c : publicCaches()) c.rebalance(); }
/** {@inheritDoc} */ @Override public Iterable<String> getCacheNames() { kernalGateway.readLockAnyway(); try { if (kernalGateway.getState() != GridKernalState.STARTED) throw new IllegalStateException(); Collection<String> res = new ArrayList<>(); for (IgniteCache<?, ?> cache : ignite.context().cache().publicCaches()) res.add(cache.getName()); return Collections.unmodifiableCollection(res); } finally { kernalGateway.readUnlock(); } }
/** * @return Public caches. */ public Collection<IgniteCacheProxy<?, ?>> caches() { guard(); try { checkClusterState(); return ctx.cache().publicCaches(); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public GridRestRequest asRestRequest(GridRedisMessage msg) throws IgniteCheckedException { assert msg != null; GridRestCacheRequest restReq = new GridRestCacheRequest(); restReq.clientId(msg.clientId()); switch (msg.command()) { case FLUSHDB: restReq.command(CACHE_REMOVE_ALL); restReq.cacheName(msg.cacheName()); break; default: // CACHE_CLEAR Map<Object, Object> redisCaches = new HashMap<>(); for (IgniteCacheProxy<?, ?> cache : ctx.cache().publicCaches()) { if (cache.getName().startsWith(CACHE_NAME_PREFIX)) { redisCaches.put(cache.getName(), null); } } if (redisCaches.isEmpty()) throw new GridRedisGenericException("No Redis caches found"); restReq.command(CACHE_CLEAR); restReq.values(redisCaches); } return restReq; }
IgniteCacheProxy<?, ?> pubCache = F.first(ignite.context().cache().publicCaches());