keith-turner commented on code in PR #3480:
URL: https://github.com/apache/accumulo/pull/3480#discussion_r1263932028


##########
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:
   > Ok, I probably should have read your entire message more closely. :)
   
   I have done that too many times.  I'd like to think I am getting better and 
learning from my mistakes, but not sure.



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