@Override
  public JSONObject getSnapshot() {
    JSONObject snapshot = new JSONObject();
    snapshot.put(REPLICA_PARTITION, getPartitionId().toPathString());
    snapshot.put(REPLICA_TYPE, getReplicaType());
    snapshot.put(CAPACITY_BYTES, getCapacityInBytes());
    snapshot.put(REPLICA_WRITE_STATE, isSealed() ? PartitionState.READ_ONLY.name() : PartitionState.READ_WRITE.name());
    String replicaLiveness = UP;
    if (isStopped) {
      replicaLiveness = REPLICA_STOPPED;
    } else if (resourceStatePolicy.isHardDown()) {
      replicaLiveness = DOWN;
    } else if (resourceStatePolicy.isDown()) {
      replicaLiveness = SOFT_DOWN;
    }
    snapshot.put(LIVENESS, replicaLiveness);
    return snapshot;
  }
Instantiate a {@link CloudServiceReplica}.
@param clusterMapConfig the {@link ClusterMapConfig} to use.
@param dataNode the {@link DataNode} to which this replica belongs to. This will usually be localhost, since that
                is where the client library runs from.
@param partition the {@link AmbryPartition} of which this is a replica.
@param capacityBytes the capacity in bytes for this replica.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/CloudServiceReplica.java