wardlican commented on code in PR #3922:
URL: https://github.com/apache/amoro/pull/3922#discussion_r2923906948


##########
amoro-ams/src/main/java/org/apache/amoro/server/BucketAssignStoreFactory.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.amoro.server;
+
+import org.apache.amoro.config.Configurations;
+import org.apache.amoro.server.ha.HighAvailabilityContainer;
+import 
org.apache.amoro.shade.zookeeper3.org.apache.curator.framework.CuratorFramework;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Factory for creating BucketAssignStore implementations based on HA 
configuration.
+ *
+ * <p>Supports different storage backends (ZK, database) according to HA type.
+ */
+public final class BucketAssignStoreFactory {
+  private static final Logger LOG = 
LoggerFactory.getLogger(BucketAssignStoreFactory.class);
+
+  private BucketAssignStoreFactory() {}
+
+  /**
+   * Creates a BucketAssignStore based on the given HA configuration and 
container.
+   *
+   * @param haContainer the HA container
+   * @param conf service configuration
+   * @return a BucketAssignStore implementation according to HA type
+   * @throws IllegalArgumentException if HA type is unsupported
+   * @throws RuntimeException if the ZK store cannot be created
+   */
+  public static BucketAssignStore create(
+      HighAvailabilityContainer haContainer, Configurations conf) {
+    String haType = conf.getString(AmoroManagementConf.HA_TYPE).toLowerCase();
+    String clusterName = conf.getString(AmoroManagementConf.HA_CLUSTER_NAME);
+
+    switch (haType) {
+      case AmoroManagementConf.HA_TYPE_ZK:
+        if (haContainer instanceof 
org.apache.amoro.server.ha.ZkHighAvailabilityContainer) {

Review Comment:
   Okay, I'll optimize it.



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