/** * @param buf Buffer to write to. * @param entry Data entry. * @throws IgniteCheckedException If failed. */ void putEncryptedDataEntry(ByteBuffer buf, DataEntry entry) throws IgniteCheckedException { DynamicCacheDescriptor desc = cctx.cache().cacheDescriptor(entry.cacheId()); if (desc != null && needEncryption(desc.groupId())) { int clSz = entrySize(entry); ByteBuffer clData = ByteBuffer.allocate(clSz); putPlainDataEntry(clData, entry); clData.rewind(); buf.put(ENCRYPTED); writeEncryptedData(desc.groupId(), null, clData, buf); } else { buf.put(PLAIN); putPlainDataEntry(buf, entry); } }
/** {@inheritDoc} */ @Override public List<List<ClusterNode>> cacheAffinity(String cacheName) { if (cacheName == null) throw new NullPointerException("Null cache name."); DynamicCacheDescriptor cacheDesc = ctx.affinity().caches().get(CU.cacheId(cacheName)); if (cacheDesc == null) throw new IllegalArgumentException("Invalid cache name: " + cacheName); GridAffinityAssignmentCache aff = ctx.affinity().groupAffinity(cacheDesc.groupId()); assert aff != null : cacheName; return aff.readyAssignments(aff.lastVersion()); }
if (cacheDescr.groupId() == e.getKey()) { removeGrp = false;
/** * Constructor of not started cache context. * * @param cacheDesc Cache descriptor. */ public GridCacheContextInfo(DynamicCacheDescriptor cacheDesc) { config = cacheDesc.cacheConfiguration(); dynamicDeploymentId = cacheDesc.deploymentId(); groupId = cacheDesc.groupId(); cacheId = CU.cacheId(config.getName()); clientCache = true; }
/** {@inheritDoc} */ @Override public List<List<ClusterNode>> cachePartitionOwners(String cacheName) { if (cacheName == null) throw new NullPointerException("Null cache name."); DynamicCacheDescriptor cacheDesc = ctx.affinity().caches().get(CU.cacheId(cacheName)); if (cacheDesc == null) throw new IllegalArgumentException("Invalid cache name: " + cacheName); if (cacheDesc.cacheConfiguration().getCacheMode() == CacheMode.LOCAL) return Collections.emptyList(); CacheGroupContext grp = ctx.cache().cacheGroup(cacheDesc.groupId()); GridDhtPartitionTopology top; if (grp == null) { top = ctx.exchange().clientTopologyIfExists(cacheDesc.groupId()); assert top != null : cacheName; } else top = grp.topology(); return top.allOwners(); }
grpIds.add(desc.groupId());
if (discoCache.cacheGroupAffinityNodes(cacheDesc.groupId()).isEmpty()) { if (cachesWithoutNodes == null) cachesWithoutNodes = new ArrayList<>();
/** */ private Set<Integer> getGroupIds() { Set<Integer> grpIds = new HashSet<>(); if (arg.getCaches() != null && !arg.getCaches().isEmpty()) { Set<String> missingCaches = new HashSet<>(); for (String cacheName : arg.getCaches()) { DynamicCacheDescriptor desc = ignite.context().cache().cacheDescriptor(cacheName); if (desc == null || !isCacheMatchFilter(cacheName)) { missingCaches.add(cacheName); continue; } grpIds.add(desc.groupId()); } handlingMissedCaches(missingCaches); } else if (onlySpecificCaches()) { for (DynamicCacheDescriptor desc : ignite.context().cache().cacheDescriptors().values()) { if (desc.cacheConfiguration().getCacheMode() != LOCAL && isCacheMatchFilter(desc.cacheName())) grpIds.add(desc.groupId()); } } else grpIds = getCacheGroupIds(); return grpIds; }
grpIds.add(desc.groupId());
/** * @param grpId Group ID. * @return Always {@code true}, fails with assert error if inconsistent. */ boolean checkStopRequestConsistency(int grpId) { Boolean destroy = null; // Check that caches associated with that group will be all stopped only or all destroyed. for (CacheActionData action : cacheStopRequests()) { if (action.descriptor().groupId() == grpId) { if (destroy == null) destroy = action.request().destroy(); else { assert action.request().destroy() == destroy : "Both cache stop only and cache destroy request associated with one group in batch " + cacheStopRequests(); } } } return true; }
CacheData cacheData = new CacheData(desc.cacheConfiguration(), desc.cacheId(), desc.groupId(), desc.cacheType(), desc.deploymentId(),
if (change.containsKey(desc.groupId())) names.add(name); });
if (grpName != null) { return initializationProtector.protect( desc.groupId(), () -> findCacheGroup(grpName), () -> startCacheGroup(
final CacheGroupContext grpCtx = ignite.context().cache().cacheGroup(desc == null ? id : desc.groupId());
if (fut.events().discoveryCache().cacheGroupAffinityNodes(info.getCacheDescriptor().groupId()).isEmpty()) U.quietAndWarn(log, "No server nodes found for cache client: " + info.getCacheDescriptor().cacheName());
.collect(Collectors.groupingBy(action -> action.descriptor().groupId()));
cache.cacheId(), cache.cacheType(), cache.groupId(), cache.groupDescriptor().cacheOrGroupName(), cache.cacheConfiguration().getCacheMode(),
/** * @param grpId Group ID. * @return Always {@code true}, fails with assert error if inconsistent. */ boolean checkStopRequestConsistency(int grpId) { Boolean destroy = null; // Check that caches associated with that group will be all stopped only or all destroyed. for (CacheActionData action : cacheStopRequests()) { if (action.descriptor().groupId() == grpId) { if (destroy == null) destroy = action.request().destroy(); else { assert action.request().destroy() == destroy : "Both cache stop only and cache destroy request associated with one group in batch " + cacheStopRequests(); } } } return true; }