class RepairRunner implements Runnable {

  static int getPossibleParallelRepairsCount(
      Map<List<String>, List<String>> ranges,
      Map<String, String> hostsInRing,
      DatacenterAvailability datacenterAvailability) throws ReaperException {

    if (ranges.isEmpty()) {
      String msg = "Repairing 0-sized cluster.";
      LOG.error(msg);
      throw new ReaperException(msg);
    }

    if (DatacenterAvailability.SIDECAR == datacenterAvailability) {
      // only 1 segment can be repaired by each instance at once in sidecar mode
      return 1;
    }

    LOG.debug(
        "Possible parallel repairs : {}",
        Math.min(
            ranges.size() / ranges.values().iterator().next().size(),
            Math.max(1, hostsInRing.keySet().size() / ranges.values().iterator().next().size())));
    return Math.min(
        ranges.size() / ranges.values().iterator().next().size(),
        Math.max(1, hostsInRing.keySet().size() / ranges.values().iterator().next().size()));
  }

  private  RepairRunner(
      AppContext context,
      UUID repairRunId,
      ClusterFacade clusterFacade);

}