SzyWilliam commented on code in PR #661:
URL: https://github.com/apache/ratis/pull/661#discussion_r909270256


##########
ratis-server/src/main/java/org/apache/ratis/server/storage/FileChunkReader.java:
##########
@@ -52,7 +58,14 @@ public FileChunkReader(FileInfo info, RaftStorageDirectory 
directory) throws IOE
         .map(p -> directory.getRoot().toPath().relativize(p))
         .orElse(info.getPath());
     final File f = info.getPath().toFile();
-    this.in = new FileInputStream(f);
+    if (info.getFileDigest() == null) {
+      digester = MD5Hash.getDigester();
+      this.in = new DigestInputStream(new FileInputStream(f), digester);
+      computeDigest = true;
+    } else {
+      this.in = new FileInputStream(f);
+      computeDigest = false;

Review Comment:
   done



##########
ratis-server/src/main/java/org/apache/ratis/server/storage/FileChunkReader.java:
##########
@@ -66,14 +79,23 @@ public FileChunkProto readFileChunk(int chunkMaxSize) 
throws IOException {
     final long remaining = info.getFileSize() - offset;
     final int chunkLength = remaining < chunkMaxSize ? (int) remaining : 
chunkMaxSize;
     final ByteString data = ByteString.readFrom(in, chunkLength);
+    boolean isDone = offset + chunkLength == info.getFileSize();
+    ByteString fileDigest = ByteString.EMPTY;

Review Comment:
   done



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