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


##########
ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java:
##########
@@ -157,6 +157,42 @@ static void setClientSize(RaftProperties properties, int 
port) {
     }
   }
 
+  interface Read {
+    String PREFIX = RaftServerConfigKeys.PREFIX
+            + "." + JavaUtils.getClassSimpleName(Read.class).toLowerCase();
+
+    String TIMEOUT_KEY = PREFIX + ".timeout";
+    TimeDuration TIMEOUT_DEFAULT = TimeDuration.valueOf(10, TimeUnit.SECONDS);
+    static TimeDuration timeout(RaftProperties properties) {
+      return 
getTimeDuration(properties.getTimeDuration(TIMEOUT_DEFAULT.getUnit()),
+          TIMEOUT_KEY, TIMEOUT_DEFAULT, getDefaultLog(), requirePositive());
+    }
+    static void setTimeout(RaftProperties properties, TimeDuration 
readOnlyTimeout) {
+      setTimeDuration(properties::setTimeDuration, TIMEOUT_KEY, 
readOnlyTimeout);
+    }
+
+    enum ReadOption {
+      /** Directly query the statemachine. Efficient but may undermine 
linearizability */
+      DEFAULT,
+      /** Use ReadIndex (see Raft section 6.4), strictly linearizable */
+      SAFE;
+      // TODO LEADER_LEASE
+
+      public static ReadOption getDefault() {
+        return DEFAULT;
+      }
+    }
+
+    String READ_OPTION_KEY = ".read.option";

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