Pengzna commented on code in PR #12355:
URL: https://github.com/apache/iotdb/pull/12355#discussion_r1617101058


##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java:
##########
@@ -0,0 +1,404 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.consensus.config;
+
+import org.apache.iotdb.commons.client.property.ClientPoolProperty;
+import org.apache.iotdb.commons.pipe.plugin.builtin.BuiltinPipePlugin;
+import org.apache.iotdb.consensus.pipe.consensuspipe.ConsensusPipeDispatcher;
+import org.apache.iotdb.consensus.pipe.consensuspipe.ConsensusPipeGuardian;
+import org.apache.iotdb.consensus.pipe.consensuspipe.ConsensusPipeReceiver;
+import org.apache.iotdb.consensus.pipe.consensuspipe.ConsensusPipeSelector;
+import org.apache.iotdb.consensus.pipe.consensuspipe.ProgressIndexManager;
+
+import java.util.concurrent.TimeUnit;
+
+public class PipeConsensusConfig {
+  private final RPC rpc;
+  private final Pipe pipe;
+  // Use stream mode by default. User can configure it
+  private ReplicateMode replicateMode = ReplicateMode.STREAM;
+
+  public PipeConsensusConfig(RPC rpc, Pipe pipe) {
+    this.rpc = rpc;
+    this.pipe = pipe;
+  }
+
+  public void setReplicateMode(ReplicateMode replicateMode) {
+    this.replicateMode = replicateMode;
+  }
+
+  public ReplicateMode getReplicateMode() {
+    return replicateMode;
+  }
+
+  public RPC getRpc() {
+    return rpc;
+  }
+
+  public Pipe getPipe() {
+    return pipe;
+  }
+
+  public static Builder newBuilder() {
+    return new Builder();
+  }
+
+  public static class Builder {
+    private RPC rpc;
+    private Pipe pipe;
+
+    public Builder setPipe(Pipe pipe) {
+      this.pipe = pipe;
+      return this;
+    }
+
+    public Builder setRPC(RPC rpc) {
+      this.rpc = rpc;
+      return this;
+    }
+
+    public PipeConsensusConfig build() {
+      return new PipeConsensusConfig(rpc, pipe);
+    }
+  }
+
+  public static class RPC {
+    private final int rpcSelectorThreadNum;
+    private final int rpcMinConcurrentClientNum;
+    private final int rpcMaxConcurrentClientNum;
+    private final int thriftServerAwaitTimeForStopService;
+    private final boolean isRpcThriftCompressionEnabled;
+    private final int selectorNumOfClientManager;
+    private final int connectionTimeoutInMs;
+    private final boolean printLogWhenThriftClientEncounterException;
+    private final int thriftMaxFrameSize;
+    private final int maxClientNumForEachNode;
+
+    public RPC(
+        int rpcSelectorThreadNum,
+        int rpcMinConcurrentClientNum,
+        int rpcMaxConcurrentClientNum,
+        int thriftServerAwaitTimeForStopService,
+        boolean isRpcThriftCompressionEnabled,
+        int selectorNumOfClientManager,
+        int connectionTimeoutInMs,
+        boolean printLogWhenThriftClientEncounterException,
+        int thriftMaxFrameSize,
+        int maxClientNumForEachNode) {
+      this.rpcSelectorThreadNum = rpcSelectorThreadNum;
+      this.rpcMinConcurrentClientNum = rpcMinConcurrentClientNum;
+      this.rpcMaxConcurrentClientNum = rpcMaxConcurrentClientNum;
+      this.thriftServerAwaitTimeForStopService = 
thriftServerAwaitTimeForStopService;
+      this.isRpcThriftCompressionEnabled = isRpcThriftCompressionEnabled;
+      this.selectorNumOfClientManager = selectorNumOfClientManager;
+      this.connectionTimeoutInMs = connectionTimeoutInMs;
+      this.printLogWhenThriftClientEncounterException = 
printLogWhenThriftClientEncounterException;
+      this.thriftMaxFrameSize = thriftMaxFrameSize;
+      this.maxClientNumForEachNode = maxClientNumForEachNode;
+    }
+
+    public int getRpcSelectorThreadNum() {
+      return rpcSelectorThreadNum;
+    }
+
+    public int getRpcMinConcurrentClientNum() {
+      return rpcMinConcurrentClientNum;
+    }
+
+    public int getRpcMaxConcurrentClientNum() {
+      return rpcMaxConcurrentClientNum;
+    }
+
+    public int getThriftServerAwaitTimeForStopService() {
+      return thriftServerAwaitTimeForStopService;
+    }
+
+    public boolean isRpcThriftCompressionEnabled() {
+      return isRpcThriftCompressionEnabled;
+    }
+
+    public int getSelectorNumOfClientManager() {
+      return selectorNumOfClientManager;
+    }
+
+    public int getConnectionTimeoutInMs() {
+      return connectionTimeoutInMs;
+    }
+
+    public boolean isPrintLogWhenThriftClientEncounterException() {
+      return printLogWhenThriftClientEncounterException;
+    }
+
+    public int getThriftMaxFrameSize() {
+      return thriftMaxFrameSize;
+    }
+
+    public int getMaxClientNumForEachNode() {
+      return maxClientNumForEachNode;
+    }
+
+    public static RPC.Builder newBuilder() {
+      return new RPC.Builder();
+    }
+
+    public static class Builder {
+      private int rpcSelectorThreadNum = 1;
+      private int rpcMinConcurrentClientNum = 
Runtime.getRuntime().availableProcessors();
+      private int rpcMaxConcurrentClientNum = 65535;
+      private int thriftServerAwaitTimeForStopService = 60;
+      private boolean isRpcThriftCompressionEnabled = false;
+      private int selectorNumOfClientManager = 1;
+      private int connectionTimeoutInMs = (int) TimeUnit.SECONDS.toMillis(20);

Review Comment:
   got it



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