xyuanlu commented on code in PR #2944:
URL: https://github.com/apache/helix/pull/2944#discussion_r1811074730
##########
helix-core/src/main/java/org/apache/helix/controller/common/CapacityNode.java:
##########
@@ -21,23 +21,57 @@
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+import org.apache.helix.controller.rebalancer.topology.Topology;
+import org.apache.helix.model.ClusterConfig;
+import org.apache.helix.model.ClusterTopologyConfig;
+import org.apache.helix.model.InstanceConfig;
+
/**
* A Node is an entity that can serve capacity recording purpose. It has a
capacity and knowledge
* of partitions assigned to it, so it can decide if it can receive additional
partitions.
*/
-public class CapacityNode {
+public class CapacityNode implements Comparable<CapacityNode> {
private int _currentlyAssigned;
private int _capacity;
- private final String _id;
+ private final String _instanceName;
+ private final String _logicaId;
+ private final String _faultZone;
private final Map<String, Set<String>> _partitionMap;
- public CapacityNode(String id) {
- _partitionMap = new HashMap<>();
- _currentlyAssigned = 0;
- this._id = id;
+ /**
+ * Constructor used for non-topology-aware use case
+ * @param instanceName The instance name of this node
+ * @param capacity The capacity of this node
+ */
+ public CapacityNode(String instanceName, int capacity) {
+ this._instanceName = instanceName;
+ this._logicaId = null;
+ this._faultZone = null;
+ this._partitionMap = new HashMap<>();
+ this._capacity = capacity;
+ this._currentlyAssigned = 0;
+ }
+
+ /**
+ * Constructor used for non-topology-aware use case
Review Comment:
i think this is for topology aware?
also can we have one constructor call another?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]