/** * Gets all alive remote nodes that have at least one cache configured. * * @return Collection of nodes. */ public Collection<ClusterNode> remoteAliveNodesWithCaches() { return F.view(rmtNodesWithCaches, aliveNodePred); }
/** * @return Reads. */ public Collection<IgniteTxEntry> reads() { return F.view(entries, CU.READ_FILTER); }
/** * @return Writes. */ public Collection<IgniteTxEntry> writes() { return F.view(entries, CU.WRITE_FILTER); }
/** {@inheritDoc} */ @Override public Map<String, Object> attributes() { // Even though discovery SPI removes this attribute after authentication, keep this check for safety. return F.view(attrs, new IgnitePredicate<String>() { @Override public boolean apply(String s) { return !IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS.equals(s); } }); }
/** * @return Near cache entries. */ @Nullable public Collection<IgniteTxEntry> nearCacheEntries() { assert nearEntries > 0; return F.view(entries, CU.FILTER_NEAR_CACHE_ENTRY); }
/** {@inheritDoc} */ @Override public Map<String, Object> attributes() { // Even though discovery SPI removes this attribute after authentication, keep this check for safety. return F.view(attrs, new SecurityCredentialsAttrFilterPredicate()); }
/** * Gets collection of server nodes with at least one cache configured. * * @return Collection of nodes. */ public Collection<ClusterNode> aliveServerNodes() { return F.view(serverNodes(), aliveNodePred); }
/** * @param node Node to remove. */ public void removeMappedNode(ClusterNode node) { if (mappedDhtNodes.contains(node)) mappedDhtNodes = new ArrayList<>(F.view(mappedDhtNodes, F.notEqualTo(node))); if (mappedNearNodes != null && mappedNearNodes.contains(node)) mappedNearNodes = new ArrayList<>(F.view(mappedNearNodes, F.notEqualTo(node))); }
/** * @return Near cache reads. */ public Collection<IgniteTxEntry> nearEntriesReads() { assert hasNearCacheEntries(); return F.view(entries, CU.READ_FILTER_NEAR); }
/** * @return Near cache writes. */ public Collection<IgniteTxEntry> nearEntriesWrites() { assert hasNearCacheEntries(); return F.view(entries, CU.WRITE_FILTER_NEAR); }
/** * @return Colocated cache reads. */ public Collection<IgniteTxEntry> colocatedEntriesReads() { assert hasColocatedCacheEntries(); return F.view(entries, CU.READ_FILTER_COLOCATED); }
/** * @return Entries. */ public Collection<GridDhtCacheEntry> entries() { return F.view(entries, F.notNull()); }
/** * @return Colocated cache writes. */ public Collection<IgniteTxEntry> colocatedEntriesWrites() { assert hasColocatedCacheEntries(); return F.view(entries, CU.WRITE_FILTER_COLOCATED); }
/** * @param nodes Nodes. * @return Backup nodes. */ public static Collection<ClusterNode> backups(Collection<ClusterNode> nodes) { if (nodes == null || nodes.size() <= 1) return Collections.emptyList(); return F.view(nodes, F.notEqualTo(F.first(nodes))); }
/** * @param part Partition. * @param topVer Topology version. * @return Backup nodes. */ private Collection<ClusterNode> backupsByPartition(int part, AffinityTopologyVersion topVer) { List<ClusterNode> nodes = nodesByPartition(part, topVer); assert !F.isEmpty(nodes); if (nodes.size() == 1) return Collections.emptyList(); return F.view(nodes, F.notEqualTo(nodes.get(0))); }
/** * Gets server nodes topology by specified version from snapshots history storage. * * @param topVer Topology version. * @return Server topology nodes. */ public Collection<ClusterNode> serverTopologyNodes(long topVer) { return F.view(topology(topVer), F.not(FILTER_CLI), FILTER_NOT_DAEMON); }
/** * @param proc Continuous processor. * @return Local event routines. */ private Collection<LocalRoutineInfo> localRoutines(GridContinuousProcessor proc) { return F.view(U.<Map<UUID, LocalRoutineInfo>>field(proc, "locInfos").values(), new IgnitePredicate<LocalRoutineInfo>() { @Override public boolean apply(LocalRoutineInfo info) { return info.handler().isEvents(); } }); }
@Override public Collection<ClusterNode> remoteDaemonNodes() { final Collection<ClusterNode> all = ctx.discovery().daemonNodes(); return !localNode().isDaemon() ? all : F.view(all, new IgnitePredicate<ClusterNode>() { @Override public boolean apply(ClusterNode n) { return n.isDaemon(); } }); }
/** * @param g Grid. * @return Non-system caches. */ private Collection<CacheConfiguration> caches(Ignite g) { return F.view(Arrays.asList(g.configuration().getCacheConfiguration()), new IgnitePredicate<CacheConfiguration>() { @Override public boolean apply(CacheConfiguration c) { return !CU.UTILITY_CACHE_NAME.equals(c.getName()) && !CU.SYS_CACHE_HADOOP_MR.equals(c.getName()); } }); } }
/** {@inheritDoc} */ @Override public Collection<ClusterNode> affinityNodes() { info("Near node ID: " + grid(nearIdx).localNode().id()); return F.view(super.affinityNodes(), new P1<ClusterNode>() { @Override public boolean apply(ClusterNode n) { return !F.eq(grid(n).name(), grid(nearIdx).name()); } }); }