szetszwo commented on code in PR #1111:
URL: https://github.com/apache/ratis/pull/1111#discussion_r1635951987


##########
ratis-server/src/main/java/org/apache/ratis/statemachine/impl/SimpleStateMachineStorage.java:
##########
@@ -228,6 +228,17 @@ public SingleFileSnapshotInfo getLatestSnapshot() {
     }
   }
 
+  public void loadLatestSnapshot() {

Review Comment:
   Let's make it return `SingleFileSnapshotInfo` and then reuse it in 
`getLatestSnapshot()`.
   ```java
   diff --git 
a/ratis-server/src/main/java/org/apache/ratis/statemachine/impl/SimpleStateMachineStorage.java
 
b/ratis-server/src/main/java/org/apache/ratis/statemachine/impl/SimpleStateMachineStorage.java
   index 88cc57dab5..7e8afbaa85 100644
   --- 
a/ratis-server/src/main/java/org/apache/ratis/statemachine/impl/SimpleStateMachineStorage.java
   +++ 
b/ratis-server/src/main/java/org/apache/ratis/statemachine/impl/SimpleStateMachineStorage.java
   @@ -217,6 +217,10 @@ public class SimpleStateMachineStorage implements 
StateMachineStorage {
        if (s != null) {
          return s;
        }
   +    return loadLatestSnapshot();
   +  }
   +
   +  public SingleFileSnapshotInfo loadLatestSnapshot() {
        final File dir = stateMachineDir;
        if (dir == null) {
          return null;
   ```



-- 
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: issues-unsubscr...@ratis.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to