jojochuang commented on code in PR #5909:
URL: https://github.com/apache/ozone/pull/5909#discussion_r1449537677


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenIdentifier.java:
##########
@@ -170,6 +181,21 @@ public void write(DataOutput out) throws IOException {
     out.write(builder.build().toByteArray());
   }
 
+  @Override
+  public byte[] getBytes() {
+    BlockTokenSecretProto.Builder builder = BlockTokenSecretProto.newBuilder()
+        .setBlockId(blockId)
+        .setOwnerId(getOwnerId())
+        .setSecretKeyId(ProtobufUtils.toProtobuf(getSecretKeyId()))
+        .setExpiryDate(getExpiryDate())
+        .setMaxLength(maxLength);
+    // Add access mode allowed
+    for (AccessModeProto mode : modes) {
+      builder.addModes(AccessModeProto.valueOf(mode.name()));
+    }
+    return builder.build().toByteArray();
+  }

Review Comment:
   Good idea.
   
   Also refactored OzoneBlockTokenIdentifier write() to use getBytes().



-- 
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]

Reply via email to