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


##########
core/src/main/java/org/apache/accumulo/core/data/LoadPlan.java:
##########
@@ -228,4 +246,88 @@ public LoadPlan build() {
       }
     };
   }
+
+  private static final TableId FAKE_ID = TableId.of("999");
+
+  private static class JsonDestination {
+    String fileName;
+    String startRow;
+    String endRow;
+    RangeType rangeType;
+
+    JsonDestination() {}
+
+    JsonDestination(Destination destination) {
+      fileName = destination.getFileName();
+      startRow = destination.getStartRow() == null ? null
+          : Base64.getUrlEncoder().encodeToString(destination.getStartRow());
+      endRow = destination.getEndRow() == null ? null
+          : Base64.getUrlEncoder().encodeToString(destination.getEndRow());
+      rangeType = destination.getRangeType();
+    }
+
+    Destination toDestination() {
+      return new Destination(fileName, rangeType,
+          startRow == null ? null : Base64.getUrlDecoder().decode(startRow),
+          endRow == null ? null : Base64.getUrlDecoder().decode(endRow));
+    }
+  }
+
+  private static final class JsonAll {
+    List<JsonDestination> destinations;
+
+    JsonAll() {}
+
+    JsonAll(List<Destination> destinations) {
+      this.destinations =
+          
destinations.stream().map(JsonDestination::new).collect(Collectors.toList());
+    }
+
+  }
+
+  private static final Gson gson = new 
GsonBuilder().disableJdkUnsafe().create();
+
+  // TODO javadoc
+  public String toJson() {
+    return gson.toJson(new JsonAll(destinations));
+  }
+
+  // TODO javadoc
+  public static LoadPlan fromJson(String json) {
+    var dests = gson.fromJson(json, JsonAll.class).destinations.stream()
+        
.map(JsonDestination::toDestination).collect(Collectors.toUnmodifiableList());
+    return new LoadPlan(dests);
+  }
+
+  // TODO javadoc
+  public static LoadPlan compute(URI file, SortedSet<Text> splits) throws 
IOException {
+
+    // TODO if the files needed a crypto service how could it be instantiated? 
Was trying to make

Review Comment:
   Made an update in 9ef0bcf to pass in a map of props which is passed to the 
Rfile api which internally calls `CryptoFactoryLoader.getServiceForClient` 
using that map of properties.



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