sreejasahithi commented on code in PR #9611:
URL: https://github.com/apache/ozone/pull/9611#discussion_r3793723557
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java:
##########
@@ -843,13 +871,21 @@ public Map<String, Pair<Boolean, String>>
getSafeModeRuleStatuses()
submitRequest(Type.GetSafeModeRuleStatuses,
builder -> builder.setGetSafeModeRuleStatusesRequest(request))
.getGetSafeModeRuleStatusesResponse();
- Map<String, Pair<Boolean, String>> map = new HashMap();
- for (SafeModeRuleStatusProto statusProto :
- response.getSafeModeRuleStatusesProtoList()) {
- map.put(statusProto.getRuleName(),
+ return buildSafeModeRuleStatusesMap(response);
+ }
+
+ /**
+ * Helper method to build a map from GetSafeModeRuleStatusesResponseProto.
+ * Extracts rule names and their status information.
+ */
+ private Map<String, Pair<Boolean, String>> buildSafeModeRuleStatusesMap(
+ GetSafeModeRuleStatusesResponseProto response) {
+ Map<String, Pair<Boolean, String>> ruleStatuses = new HashMap<>();
+ for (SafeModeRuleStatusProto statusProto :
response.getSafeModeRuleStatusesProtoList()) {
+ ruleStatuses.put(statusProto.getRuleName(),
Pair.of(statusProto.getValidate(), statusProto.getStatusText()));
}
- return map;
+ return ruleStatuses;
}
Review Comment:
Thanks @szetszwo for pointing this out. Agreed Map<String, Pair<Boolean,
String>> is not needed given SafeModeRuleStatusProto.
Will take a look at HDDS-16130
--
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]