@Override
  public JSONObject getSnapshot() {
    JSONObject snapshot = new JSONObject();
    DataNodeId dataNodeId = getDataNodeId();
    snapshot.put(REPLICA_NODE, dataNodeId.getHostname() + ":" + dataNodeId.getPort());
    snapshot.put(REPLICA_PARTITION, getPartitionId().toPathString());
    snapshot.put(REPLICA_TYPE, getReplicaType());
    snapshot.put(REPLICA_DISK, getDiskId().getMountPath());
    snapshot.put(REPLICA_PATH, getReplicaPath());
    snapshot.put(CAPACITY_BYTES, getCapacityInBytes());
    snapshot.put(REPLICA_WRITE_STATE, ClusterMapUtils.convertReplicaSealStatusToPartitionState(getSealedStatus()));
    String replicaLiveness = UP;
    if (dataNodeId.getState() == HardwareState.UNAVAILABLE) {
      replicaLiveness = NODE_DOWN;
    } else if (disk.getState() == HardwareState.UNAVAILABLE) {
      replicaLiveness = DISK_DOWN;
    } else 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 disk-backed AmbryReplica instance.
@param clusterMapConfig the {@link ClusterMapConfig} to use.
@param partition the {@link AmbryPartition} of which this is a replica.
@param disk the {@link AmbryDisk} on which this replica resides.
@param isReplicaStopped whether this replica is stopped or not.
@param capacityBytes the capacity in bytes for this replica.
@param replicaSealStatus {@link ReplicaSealStatus} of the replica.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/AmbryServerReplica.java