class RepairUnitService {

  Set<String> getTablesToRepair(Cluster cluster, RepairUnit repairUnit) throws ReaperException {
    String keyspace = repairUnit.getKeyspaceName();
    Set<String> result;

    if (repairUnit.getColumnFamilies().isEmpty()) {
      Set<Table> tables = ClusterFacade.create(context).getTablesForKeyspace(cluster, keyspace);
      Set<String> twcsBlacklisted = findBlacklistedCompactionStrategyTables(cluster, tables);

      result = tables.stream()
          .map(Table::getName)
          .filter(tableName -> !repairUnit.getBlacklistedTables().contains(tableName))
          .filter(tableName -> !twcsBlacklisted.contains(tableName))
          .collect(Collectors.toSet());
    } else {
      // if tables have been specified then don't apply the twcsBlacklisting
      result = repairUnit.getColumnFamilies().stream()
            .filter(tableName -> !repairUnit.getBlacklistedTables().contains(tableName))
            .collect(Collectors.toSet());
    }

    Preconditions.checkState(
        repairUnit.getBlacklistedTables().isEmpty() || !result.isEmpty(),
        "Invalid blacklist definition. It filtered out all tables in the keyspace.");

    return result;
  }

  private  RepairUnitService(AppContext context);

}