cshannon commented on code in PR #3480:
URL: https://github.com/apache/accumulo/pull/3480#discussion_r1263699208


##########
core/src/main/java/org/apache/accumulo/core/metadata/StoredTabletFile.java:
##########
@@ -121,11 +150,105 @@ public String toString() {
    * Validates that the provided metadata string for the StoredTabletFile is 
valid.
    */
   public static void validate(String metadataEntry) {
-    ReferencedTabletFile.parsePath(new Path(URI.create(metadataEntry)));
+    ReferencedTabletFile.parsePath(deserialize(metadataEntry).path);
+  }
+
+  public static StoredTabletFile of(final Text metadataEntry) {
+    return new 
StoredTabletFile(Objects.requireNonNull(metadataEntry).toString());
   }
 
   public static StoredTabletFile of(final String metadataEntry) {
     return new StoredTabletFile(metadataEntry);
   }
 
+  public static StoredTabletFile of(final URI path, Range range) {
+    return of(new Path(Objects.requireNonNull(path)), range);
+  }
+
+  public static StoredTabletFile of(final Path path, Range range) {
+    return new StoredTabletFile(new TabletFileCq(Objects.requireNonNull(path), 
range));
+  }
+
+  private static final Gson gson = 
ByteArrayToBase64TypeAdapter.createBase64Gson();
+
+  private static TabletFileCq deserialize(String json) {
+    final TabletFileCqMetadataGson metadata =
+        gson.fromJson(Objects.requireNonNull(json), 
TabletFileCqMetadataGson.class);
+    // If we have previously enforced the exclusive/inclusive of a range then 
can just set that here
+    return new TabletFileCq(new Path(URI.create(metadata.path)),
+        new Range(decodeRow(metadata.startRow), false, 
decodeRow(metadata.endRow), true));

Review Comment:
   And right after I typed my message I saw your unit test that passes equality 
with the flags switched, let me take a closer look at that as that seems odd to 
me because I did a glance at the Range class and it seemed like it was using 
the flags as part of the equality check.



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