-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace ClusterRun with RepairRunStatus
- Loading branch information
Showing
7 changed files
with
71 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 0 additions & 111 deletions
111
src/main/java/com/spotify/reaper/resources/view/ClusterRun.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/com/spotify/reaper/storage/postgresql/RepairRunStatusMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.spotify.reaper.storage.postgresql; | ||
|
||
import com.google.common.collect.ImmutableSet; | ||
|
||
import com.spotify.reaper.core.RepairRun; | ||
import com.spotify.reaper.resources.view.RepairRunStatus; | ||
|
||
import org.apache.cassandra.repair.RepairParallelism; | ||
import org.joda.time.DateTime; | ||
import org.skife.jdbi.v2.StatementContext; | ||
import org.skife.jdbi.v2.tweak.ResultSetMapper; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.util.Collection; | ||
|
||
public class RepairRunStatusMapper implements ResultSetMapper<RepairRunStatus> { | ||
|
||
@Override | ||
public RepairRunStatus map(int index, ResultSet r, StatementContext ctx) throws SQLException { | ||
long runId = r.getLong("id"); | ||
String clusterName = r.getString("cluster_name"); | ||
String keyspaceName = r.getString("keyspace_name"); | ||
Collection<String> columnFamilies = | ||
ImmutableSet.copyOf((String[]) r.getArray("column_families").getArray()); | ||
int segmentsRepaired = (int)r.getLong("count"); | ||
int totalSegments = r.getInt("segment_count"); | ||
RepairRun.RunState state = RepairRun.RunState.valueOf(r.getString("state")); | ||
DateTime startTime = RepairRunMapper.getDateTimeOrNull(r, "start_time"); | ||
DateTime endTime = RepairRunMapper.getDateTimeOrNull(r, "end_time"); | ||
String cause = r.getString("cause"); | ||
String owner = r.getString("owner"); | ||
String lastEvent = r.getString("last_event"); | ||
DateTime creationTime = RepairRunMapper.getDateTimeOrNull(r, "creation_time"); | ||
DateTime pauseTime = RepairRunMapper.getDateTimeOrNull(r, "pause_time"); | ||
Double intensity = r.getDouble("intensity"); | ||
RepairParallelism repairParallelism = | ||
RepairParallelism.valueOf(r.getString("repair_parallelism")); | ||
return new RepairRunStatus(runId, clusterName, keyspaceName, columnFamilies, segmentsRepaired, | ||
totalSegments, state, startTime, endTime, cause, owner, lastEvent, | ||
creationTime, pauseTime, intensity, repairParallelism); | ||
} | ||
} |