Class BrokerClusterStateImpl
java.lang.Object
io.camunda.zeebe.broker.client.impl.BrokerClusterStateImpl
- All Implemented Interfaces:
BrokerClusterState
-
Field Summary
FieldsFields inherited from interface io.camunda.zeebe.broker.client.api.BrokerClusterState
NODE_ID_NULL, PARTITION_ID_NULL, UNKNOWN_NODE_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddBrokerIfAbsent(int nodeId) voidaddPartitionFollower(int partitionId, int followerId) voidaddPartitionIfAbsent(int partitionId) voidaddPartitionInactive(int partitionId, int brokerId) getBrokerAddress(int brokerId) getBrokerVersion(int brokerId) intgetFollowersForPartition(int partition) getInactiveNodesForPartition(int partition) intgetLeaderForPartition(int partition) intgetPartition(int index) getPartitionHealth(int brokerId, int partitionId) intintintbooleanvoidremoveBroker(int brokerId) voidsetBrokerAddressIfPresent(int brokerId, String address) voidsetBrokerVersionIfPresent(int brokerId, String version) voidsetClusterSize(int clusterSize) voidsetPartitionHealthStatus(int brokerId, int partitionId, PartitionHealthStatus status) voidsetPartitionLeader(int partitionId, int leaderId, long term) voidsetPartitionsCount(int partitionsCount) voidsetReplicationFactor(int replicationFactor) voidsyncPartitions(int nodeId, Set<Integer> partitions) Syncs the partitions of the given node with the local state.toString()
-
Field Details
-
UNINITIALIZED_CLUSTER_SIZE
public static final int UNINITIALIZED_CLUSTER_SIZE- See Also:
-
-
Constructor Details
-
BrokerClusterStateImpl
-
BrokerClusterStateImpl
public BrokerClusterStateImpl()
-
-
Method Details
-
setPartitionLeader
public void setPartitionLeader(int partitionId, int leaderId, long term) -
syncPartitions
Syncs the partitions of the given node with the local state. Removes partitions which are not present on the node anymore. -
setPartitionHealthStatus
-
addPartitionFollower
public void addPartitionFollower(int partitionId, int followerId) -
addPartitionInactive
public void addPartitionInactive(int partitionId, int brokerId) -
addPartitionIfAbsent
public void addPartitionIfAbsent(int partitionId) -
addBrokerIfAbsent
public boolean addBrokerIfAbsent(int nodeId) -
setBrokerAddressIfPresent
-
setBrokerVersionIfPresent
-
removeBroker
public void removeBroker(int brokerId) -
isInitialized
public boolean isInitialized()- Specified by:
isInitializedin interfaceBrokerClusterState
-
getClusterSize
public int getClusterSize()- Specified by:
getClusterSizein interfaceBrokerClusterState
-
setClusterSize
public void setClusterSize(int clusterSize) -
getPartitionsCount
public int getPartitionsCount()- Specified by:
getPartitionsCountin interfaceBrokerClusterState
-
setPartitionsCount
public void setPartitionsCount(int partitionsCount) -
getReplicationFactor
public int getReplicationFactor()- Specified by:
getReplicationFactorin interfaceBrokerClusterState
-
setReplicationFactor
public void setReplicationFactor(int replicationFactor) -
getLeaderForPartition
public int getLeaderForPartition(int partition) - Specified by:
getLeaderForPartitionin interfaceBrokerClusterState
-
getFollowersForPartition
- Specified by:
getFollowersForPartitionin interfaceBrokerClusterState
-
getInactiveNodesForPartition
- Specified by:
getInactiveNodesForPartitionin interfaceBrokerClusterState
-
getRandomBroker
public int getRandomBroker()- Specified by:
getRandomBrokerin interfaceBrokerClusterState- Returns:
- the node id of a random broker or
BrokerClusterState.UNKNOWN_NODE_IDif no brokers are known
-
getPartitions
- Specified by:
getPartitionsin interfaceBrokerClusterState
-
getBrokers
- Specified by:
getBrokersin interfaceBrokerClusterState
-
getBrokerAddress
- Specified by:
getBrokerAddressin interfaceBrokerClusterState
-
getPartition
public int getPartition(int index) - Specified by:
getPartitionin interfaceBrokerClusterState
-
getBrokerVersion
- Specified by:
getBrokerVersionin interfaceBrokerClusterState
-
getPartitionHealth
- Specified by:
getPartitionHealthin interfaceBrokerClusterState
-
toString
-