You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/06/22 16:49:10 UTC

[GitHub] [ozone] umamaheswararao commented on a change in pull request #2341: HDDS-5350 : Add allocate block support in MockOmTransport

umamaheswararao commented on a change in pull request #2341:
URL: https://github.com/apache/ozone/pull/2341#discussion_r656406227



##########
File path: hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/MockOmTransport.java
##########
@@ -116,13 +117,24 @@ public OMResponse submitRequest(OMRequest payload) throws IOException {
       return response(payload,
           r -> r.setServiceListResponse(
               serviceList(payload.getServiceListRequest())));
+    case AllocateBlock:
+      return response(payload, r -> r.setAllocateBlockResponse(
+          allocateBlock(payload.getAllocateBlockRequest())));
     default:
       throw new IllegalArgumentException(
           "Mock version of om call " + payload.getCmdType()
               + " is not yet implemented");
     }
   }
 
+  private OzoneManagerProtocolProtos.AllocateBlockResponse allocateBlock(
+      OzoneManagerProtocolProtos.AllocateBlockRequest allocateBlockRequest) {
+    return OzoneManagerProtocolProtos.AllocateBlockResponse.newBuilder()
+        .setKeyLocation(
+            blockAllocator.allocateBlock(allocateBlockRequest.getKeyArgs())
+                .iterator().next()).build();

Review comment:
       Let me add loop here for all KeyArgs available




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org