cshannon commented on code in PR #4480:
URL: https://github.com/apache/accumulo/pull/4480#discussion_r1605145016
##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/SelectedFiles.java:
##########
@@ -44,27 +46,47 @@ public class SelectedFiles {
private final Set<StoredTabletFile> files;
private final boolean initiallySelectedAll;
private final FateId fateId;
+ private final int completedJobs;
+ private final SteadyTime selectedTime;
private String metadataValue;
private static final Gson GSON = new GsonBuilder()
.registerTypeAdapter(SelectedFiles.class, new
SelectedFilesTypeAdapter()).create();
- public SelectedFiles(Set<StoredTabletFile> files, boolean
initiallySelectedAll, FateId fateId) {
+ public SelectedFiles(Set<StoredTabletFile> files, boolean
initiallySelectedAll, FateId fateId,
+ SteadyTime selectedTime) {
+ this(files, initiallySelectedAll, fateId, 0, selectedTime);
+ }
+
+ public SelectedFiles(Set<StoredTabletFile> files, boolean
initiallySelectedAll, FateId fateId,
+ int completedJobs, SteadyTime selectedTime) {
Preconditions.checkArgument(files != null && !files.isEmpty());
this.files = Set.copyOf(files);
this.initiallySelectedAll = initiallySelectedAll;
this.fateId = fateId;
+ this.completedJobs = completedJobs;
+ this.selectedTime = selectedTime;
}
private static class SelectedFilesTypeAdapter extends
TypeAdapter<SelectedFiles> {
+ // These fields could be moved to an enum but for now just using static
Strings
+ // seems better to avoid having to construct an enum each time the string
is read
+ private static final String FATE_ID = "fateId";
+ private static final String SELECTED_ALL = "selAll";
+ private static final String COMPLETED_JOBS = "compJobs";
+ private static final String FILES = "files";
+ private static final String SELECTED_TIME = "selTime";
+
@Override
public void write(JsonWriter out, SelectedFiles selectedFiles) throws
IOException {
out.beginObject();
- out.name("fateId").value(selectedFiles.getFateId().canonical());
- out.name("selAll").value(selectedFiles.initiallySelectedAll());
- out.name("files").beginArray();
+ out.name(FATE_ID).value(selectedFiles.getFateId().canonical());
+ out.name(SELECTED_ALL).value(selectedFiles.initiallySelectedAll());
+ out.name(COMPLETED_JOBS).value(selectedFiles.getCompletedJobs());
+
out.name(SELECTED_TIME).value(selectedFiles.getSelectedTime().getNanos());
Review Comment:
To avoid the serialization impact I renamed SELECTED_TIME to
SELECTED_TIME_NANOS which uses the string "selTimeNanos" so it is clear what
the value is.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]