jerryshao commented on code in PR #5155:
URL: https://github.com/apache/gravitino/pull/5155#discussion_r1806245659


##########
server/src/main/java/org/apache/gravitino/server/web/rest/MetalakeOperations.java:
##########
@@ -149,6 +154,101 @@ public Response loadMetalake(@PathParam("name") String 
metalakeName) {
     }
   }
 
+  @PATCH
+  @Path("{name}")
+  @Produces("application/vnd.gravitino.v1+json")
+  @Timed(name = "set-metalake." + MetricNames.HTTP_PROCESS_DURATION, absolute 
= true)
+  @ResponseMetered(name = "set-metalake", absolute = true)
+  public Response setMetalake(@PathParam("name") String metalakeName, 
MetalakeSetRequest request) {
+    LOG.info("Received set request for metalake: {}", metalakeName);
+    try {
+      return Utils.doAs(
+          httpRequest,
+          () -> {
+            NameIdentifier identifier = 
NameIdentifierUtil.ofMetalake(metalakeName);
+            TreeLockUtils.doWithTreeLock(
+                identifier,
+                LockType.WRITE,
+                () -> {
+                  if (request.isInUse()) {
+                    metalakeDispatcher.enableMetalake(identifier);
+                  } else {
+                    metalakeDispatcher.disableMetalake(identifier);
+                  }
+                  return null;
+                });
+            Response response = Utils.ok(new BaseResponse());
+            LOG.info(
+                "Successfully {} metalake: {}",
+                request.isInUse() ? "enable" : "disable",
+                metalakeName);
+            return response;
+          });
+
+    } catch (Exception e) {
+      LOG.info("Failed to {} metalake: {}", request.isInUse() ? "enable" : 
"disable", metalakeName);
+      return ExceptionHandlers.handleMetalakeException(OperationType.LOAD, 
metalakeName, e);
+    }
+  }
+
+  @GET
+  @Path("{name}/activate")
+  @Produces("application/vnd.gravitino.v1+json")
+  @Timed(name = "activate-metalake." + MetricNames.HTTP_PROCESS_DURATION, 
absolute = true)
+  @ResponseMetered(name = "activate-metalake", absolute = true)
+  public Response activateMetalake(@PathParam("name") String metalakeName) {

Review Comment:
   Why do we still keep this method and the below one?



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

Reply via email to