dlmarion commented on code in PR #5237:
URL: https://github.com/apache/accumulo/pull/5237#discussion_r1907604141


##########
core/src/main/java/org/apache/accumulo/core/metadata/StoredTabletFile.java:
##########
@@ -291,9 +291,41 @@ public TabletFileCq(Path path, Range range) {
     }
   }
 
-  private static class TabletFileCqMetadataGson {
+  static class TabletFileCqMetadataGson {
     private String path;
     private byte[] startRow;
     private byte[] endRow;
+
+    TabletFileCqMetadataGson() {}
+
+    TabletFileCqMetadataGson(AbstractTabletFile<?> atf) {
+      path = Objects.requireNonNull(atf.path.toString());
+      startRow = encodeRow(atf.range.getStartKey());
+      endRow = encodeRow(atf.range.getEndKey());
+    }
+
+    ReferencedTabletFile toReferencedTabletFile() {
+      return new ReferencedTabletFile(new Path(URI.create(path)),
+          new Range(decodeRow(startRow), true, decodeRow(endRow), false));
+    }
+
+    StoredTabletFile toStoredTabletFile() {
+      return new StoredTabletFile(new TabletFileCq(new Path(URI.create(path)),
+          new Range(decodeRow(startRow), true, decodeRow(endRow), false)));
+    }
+  }
+
+  static StoredTabletFile fomTabletFileCqMetadataGson(String serialized) {
+    return new StoredTabletFile(deserialize(serialized));
+  }
+
+  TabletFileCqMetadataGson toTabletFileCqMetadataGson() {
+    requireKeyExtentDataRange(range);
+    final TabletFileCqMetadataGson metadata = new TabletFileCqMetadataGson();
+    metadata.path = Objects.requireNonNull(path).toString();
+    metadata.startRow = encodeRow(range.getStartKey());
+    metadata.endRow = encodeRow(range.getEndKey());
+    return metadata;

Review Comment:
   Good call, I ended up just removing this method entirely in acfa49f and used 
the TabletFileCqMetadataGson constructor in both cases in CompactionMetadata.



-- 
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]

Reply via email to