private void validateConstraints() {
    // Ensure each replica is on distinct Disk and DataNode.
    Set<DataNodeId> dataNodeSet = new HashSet<>();
    Set<DiskId> diskSet = new HashSet<>();

    for (ReplicaId replica : replicas) {
      if (!diskSet.add(replica.getDiskId())) {
        throw new IllegalStateException(
            "Multiple Replicas for same Partition are layed out on same Disk: " + toString());
      }
      if (!dataNodeSet.add((replica.getDiskId()).getDataNodeId())) {
        throw new IllegalStateException(
            "Multiple Replicas for same Partition are layed out on same DataNode: " + toString());
      }
    }
  }
Construct name based on Partition ID appropriate for use as a file or directory name.

@return string representation of the Partition's ID for use as part of file system path.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/Partition.java