/** * @param part Partition. * @param topVer Topology version. * @return Primary node for given key. */ @Nullable public GridNode primary(int part, long topVer) { Collection<GridNode> nodes = nodes(part, topVer); if (nodes.isEmpty()) return null; return nodes.iterator().next(); }
/** * @param part Partition. * @param topVer Topology version. * @return Backup nodes. */ public Collection<GridNode> backups(int part, long topVer) { Collection<GridNode> nodes = nodes(part, topVer); assert !F.isEmpty(nodes); if (nodes.size() <= 1) return Collections.emptyList(); return F.view(nodes, F.notEqualTo(nodes.iterator().next())); }