joshelser commented on a change in pull request #25: RATIS-588 LogStream 
StateMachine export
URL: https://github.com/apache/incubator-ratis/pull/25#discussion_r294456145
 
 

 ##########
 File path: 
ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogStateMachine.java
 ##########
 @@ -452,29 +503,166 @@ public void close() {
 
 
 
-  private CompletableFuture<Message> processCloseLog(LogServiceRequestProto 
logServiceRequestProto) {
-    CloseLogRequestProto closeLog = logServiceRequestProto.getCloseLog();
+  private CompletableFuture<Message> processChangeState(LogServiceRequestProto 
logServiceRequestProto) {
+    LogServiceProtos.ChangeStateLogRequestProto changeState = 
logServiceRequestProto.getChangeState();
     // Need to check whether the file is opened if opened close it.
     // TODO need to handle exceptions while operating with files.
+    Throwable t = verifyState(State.OPEN);
+    this.state= State.valueOf(changeState.getState().name());
 
 Review comment:
   We should have validation on the previous state and the state being 
requested to be moved to. For example, `ARCHIVED` to `ARCHIVING` is invalid.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to