private boolean hasEnoughEligibleWritableReplicas(PartitionId partitionId) {
      if (localDatacenterName != null && !localDatacenterName.isEmpty()) {
        return areAllLocalReplicasForPartitionUp(partitionId) && areAllReplicaStatesEligibleForPut(partitionId,
            localDatacenterName);
      } else {
        return areAllReplicasForPartitionUp(partitionId) && areAllReplicaStatesEligibleForPut(partitionId, null);
      }
    }
Check whether the partition has enough eligible replicas for write operations to try. Here, "eligible" means
replica is up and in required states for PUT request (i.e LEADER or STANDBY). Enough replicas is considered to be
all local replicas if such information is available. In case localDatacenterName is not available, all of the
partition's replicas should be up.
@param partitionId the {@link PartitionId} to check.
@return true if enough replicas are eligible; false otherwise.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/ClusterMapUtils.java