类 ConsensusManager
- java.lang.Object
-
- org.apache.iotdb.confignode.manager.ConsensusManager
-
public class ConsensusManager extends java.lang.ObjectConsensusManager maintains consensus class, request will redirect to consensus layer
-
-
构造器概要
构造器 构造器 说明 ConsensusManager(IManager configManager, ConfigNodeRegionStateMachine stateMachine)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddConfigNodePeer(org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation configNodeLocation)Add a new ConfigNode Peer into ConfigNodeRegionvoidclose()org.apache.iotdb.common.rpc.thrift.TSStatusconfirmLeader()Confirm the current ConfigNode's leadershipvoidcreatePeerForConsensusGroup(java.util.List<org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation> configNodeLocations)Create peer in new node to build consensus grouporg.apache.iotdb.commons.consensus.ConsensusGroupIdgetConsensusGroupId()org.apache.iotdb.consensus.IConsensusgetConsensusImpl()org.apache.iotdb.common.rpc.thrift.TConfigNodeLocationgetLeader()booleanisLeader()org.apache.iotdb.consensus.common.response.ConsensusReadResponseread(ConfigPhysicalPlan plan)Transmit PhysicalPlan to confignode.consensus.statemachinebooleanremoveConfigNodePeer(org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation tConfigNodeLocation)Remove a ConfigNode Peer out of ConfigNodeRegionvoidsingleCopyMayWaitUntilLeaderReady()org.apache.iotdb.consensus.common.response.ConsensusWriteResponsewrite(ConfigPhysicalPlan plan)Transmit PhysicalPlan to confignode.consensus.statemachine
-
-
-
构造器详细资料
-
ConsensusManager
public ConsensusManager(IManager configManager, ConfigNodeRegionStateMachine stateMachine) throws java.io.IOException
- 抛出:
java.io.IOException
-
-
方法详细资料
-
close
public void close() throws java.io.IOException- 抛出:
java.io.IOException
-
createPeerForConsensusGroup
public void createPeerForConsensusGroup(java.util.List<org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation> configNodeLocations)
Create peer in new node to build consensus group- 参数:
configNodeLocations- All registered ConfigNodes
-
addConfigNodePeer
public void addConfigNodePeer(org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation configNodeLocation) throws AddPeerExceptionAdd a new ConfigNode Peer into ConfigNodeRegion- 参数:
configNodeLocation- The new ConfigNode- 抛出:
AddPeerException- When addPeer doesn't success
-
removeConfigNodePeer
public boolean removeConfigNodePeer(org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation tConfigNodeLocation)
Remove a ConfigNode Peer out of ConfigNodeRegion- 参数:
tConfigNodeLocation- config node location- 返回:
- True if successfully removePeer. False if another ConfigNode is being removed to the ConfigNodeRegion
-
write
public org.apache.iotdb.consensus.common.response.ConsensusWriteResponse write(ConfigPhysicalPlan plan)
Transmit PhysicalPlan to confignode.consensus.statemachine
-
read
public org.apache.iotdb.consensus.common.response.ConsensusReadResponse read(ConfigPhysicalPlan plan)
Transmit PhysicalPlan to confignode.consensus.statemachine
-
isLeader
public boolean isLeader()
-
getLeader
public org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation getLeader()
- 返回:
- ConfigNode-leader's location if leader exists, null otherwise.
-
confirmLeader
public org.apache.iotdb.common.rpc.thrift.TSStatus confirmLeader()
Confirm the current ConfigNode's leadership- 返回:
- SUCCESS_STATUS if the current ConfigNode is leader, NEED_REDIRECTION otherwise
-
getConsensusGroupId
public org.apache.iotdb.commons.consensus.ConsensusGroupId getConsensusGroupId()
-
getConsensusImpl
public org.apache.iotdb.consensus.IConsensus getConsensusImpl()
-
singleCopyMayWaitUntilLeaderReady
public void singleCopyMayWaitUntilLeaderReady()
-
-