mgao0 commented on code in PR #2380:
URL: https://github.com/apache/helix/pull/2380#discussion_r1122144803
##########
helix-core/src/main/java/org/apache/helix/model/Message.java:
##########
@@ -966,4 +966,46 @@ public boolean isValid() {
}
return true;
}
+
+ /**
+ * This class is for categorizing state transition messages based on certain
properties, and generating
+ */
+ public static class MessageInfo {
+ public String _msgType;
+ public String _resourceName;
+ public String _fromState;
+ public String _toState;
+
+ public enum MessageIdentifierBase {
+ PER_RESOURCE, PER_STATE_TRANSITION_TYPE
+ }
+
+ public MessageInfo(Message message) {
+ _msgType = message.getMsgType();
+ _resourceName = message.getResourceName();
+ _fromState = message.getFromState();
+ _toState = message.getToState();
+ }
+
+ public String getMessageIdentifier(MessageIdentifierBase basis) {
+ String delimiter = ".";
+ if (_msgType == null) {
+ return null;
+ }
+ String identifier = _msgType;
+ if (basis.ordinal() >= MessageIdentifierBase.PER_RESOURCE.ordinal()) {
Review Comment:
The original code is to concatenate strings for each level resource -> state
transition type... This is for the same purpose.
But as we discussed earlier, some levels can be parallel, not necessarily
hierarchical. For example we can have resourceName_stateTransitionType,
resourceName_rebalanceType, where stateTransitionType and rebalanceType are
parallel. I modified the code of comparing the ordinal, please take another
look. Thanks.
--
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]