private boolean areAllReplicaStatesEligibleForPut(PartitionId partitionId, String dcName) {
      Set<ReplicaId> eligibleReplicas = new HashSet<>();
      EnumSet.of(ReplicaState.STANDBY, ReplicaState.LEADER)
          .forEach(state -> eligibleReplicas.addAll(partitionId.getReplicaIdsByState(state, dcName)));
      List<? extends ReplicaId> replicas;
      if (dcName != null) {
        replicas = partitionIdToLocalReplicas.get(partitionId);
      } else {
        replicas = partitionId.getReplicaIds();
      }
      logger.debug("Partition for Put {}, all replicas {}, eligible replicas {}", partitionId.toPathString(), replicas,
          eligibleReplicas);
      return replicas.size() == eligibleReplicas.size();
    }
Check if all replicas from given partition are in eligible states for PUT request. (That is, replica state should
be either LEADER or STANDBY.)
@param partitionId the {@link PartitionId} to check.
@param dcName the datacenter which replicas come from. If null, replicas from all datacenters should be checked.
@return true if all replicas are eligible for put.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/ClusterMapUtils.java