Exemplo n.º 1
0
  /**
   * @param keys keys.
   * @param topVer Topology version.
   * @return Nodes for the keys.
   */
  public Collection<GridNode> remoteNodes(Iterable<? extends K> keys, long topVer) {
    Collection<Collection<GridNode>> colcol = new GridLeanSet<>();

    for (K key : keys) colcol.add(nodes(key, topVer));

    return F.view(F.flatCollections(colcol), F.remoteNodes(cctx.localNodeId()));
  }
Exemplo n.º 2
0
  /**
   * @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()));
  }
Exemplo n.º 3
0
 /**
  * @param n Node to check.
  * @param part Partition.
  * @param topVer Topology version.
  * @return {@code True} if checked node is primary for given key.
  */
 public boolean primary(GridNode n, int part, long topVer) {
   return F.eq(primary(part, topVer), n);
 }
Exemplo n.º 4
0
 /**
  * @param n Node to check.
  * @param key Key to check.
  * @param topVer Topology version.
  * @return {@code True} if checked node is primary for given key.
  */
 public boolean primary(GridNode n, K key, long topVer) {
   return F.eq(primary(key, topVer), n);
 }