diff --git a/dble_checkstyle.xml b/dble_checkstyle.xml index 5feb04e7e..89a2d93a9 100644 --- a/dble_checkstyle.xml +++ b/dble_checkstyle.xml @@ -151,7 +151,7 @@ + value="(com\.actiontech\.dble\.DbleStartup)|(com\.actiontech\.dble\.config\.loader\.zkprocess\.xmltozk\.XmltoZkMain)|(com\.actiontech\.dble\.util\.DecryptUtil)|(com\.actiontech\.dble\.util\.dataMigrator\.DataMigrator)|(com\.actiontech\.dble\.cluster\.xmltoKv\.XmltoCluster)"/> diff --git a/dble_checkstyle_suppression.xml b/dble_checkstyle_suppression.xml index 3e97b2de9..b9b0f93f4 100644 --- a/dble_checkstyle_suppression.xml +++ b/dble_checkstyle_suppression.xml @@ -13,6 +13,8 @@ + + diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml index 91fa9a102..b7ed9d6e5 100644 --- a/findbugs-exclude.xml +++ b/findbugs-exclude.xml @@ -27,6 +27,9 @@ + + + diff --git a/src/main/java/com/actiontech/dble/DbleServer.java b/src/main/java/com/actiontech/dble/DbleServer.java index 138bd43bc..f612069b8 100644 --- a/src/main/java/com/actiontech/dble/DbleServer.java +++ b/src/main/java/com/actiontech/dble/DbleServer.java @@ -16,9 +16,9 @@ import com.actiontech.dble.backend.mysql.xa.recovery.impl.KVStoreRepository; import com.actiontech.dble.buffer.BufferPool; import com.actiontech.dble.buffer.DirectByteBufferPool; import com.actiontech.dble.cache.CacheService; +import com.actiontech.dble.cluster.ClusterGeneralConfig; import com.actiontech.dble.cluster.ClusterParamCfg; import com.actiontech.dble.config.ServerConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; import com.actiontech.dble.config.loader.zkprocess.comm.ZkConfig; import com.actiontech.dble.config.model.SchemaConfig; import com.actiontech.dble.config.model.SystemConfig; @@ -75,6 +75,7 @@ public final class DbleServer { private static final long DEFAULT_OLD_CONNECTION_CLEAR_PERIOD = 5 * 1000L; private static final DbleServer INSTANCE = new DbleServer(); + private static final Logger LOGGER = LoggerFactory.getLogger("Server"); private AtomicBoolean backupLocked; @@ -171,8 +172,8 @@ public final class DbleServer { id.append("'" + NAME + "Server."); if (isUseZK()) { id.append(ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); - } else if (isUseUcore()) { - id.append(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + } else if (isUseGeneralCluster()) { + id.append(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); } else { id.append(this.getConfig().getSystem().getServerNodeId()); @@ -363,6 +364,7 @@ public final class DbleServer { if (system.getEnableSlowLog() == 1) { SlowQueryLog.getInstance().setEnableSlowLog(true); } + AlertUtil.initAlert(); if (system.getEnableAlert() == 1) { AlertUtil.switchAlert(true); } @@ -426,7 +428,7 @@ public final class DbleServer { userManager.initForLatest(config.getUsers(), system.getMaxCon()); - if (isUseUcore()) { + if (isUseGeneralCluster()) { try { OnlineLockStatus.getInstance().metaUcoreInit(true); } catch (Exception e) { @@ -694,11 +696,12 @@ public final class DbleServer { } public boolean isUseZK() { - return ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) != null; + return ClusterGeneralConfig.getInstance().isUseCluster() && ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) != null; } - public boolean isUseUcore() { - return UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) != null; + public boolean isUseGeneralCluster() { + return ClusterGeneralConfig.getInstance().isUseCluster() && + ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) == null; } public TxnLogProcessor getTxnLogProcessor() { @@ -1081,4 +1084,5 @@ public final class DbleServer { return userManager; } + } diff --git a/src/main/java/com/actiontech/dble/alarm/AlertUtil.java b/src/main/java/com/actiontech/dble/alarm/AlertUtil.java index f10737df6..4dfc0bda1 100644 --- a/src/main/java/com/actiontech/dble/alarm/AlertUtil.java +++ b/src/main/java/com/actiontech/dble/alarm/AlertUtil.java @@ -5,8 +5,9 @@ package com.actiontech.dble.alarm; -import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; +import com.actiontech.dble.DbleServer; +import com.actiontech.dble.cluster.ClusterController; +import com.actiontech.dble.cluster.ClusterGeneralConfig; import java.util.HashMap; import java.util.Map; @@ -26,7 +27,12 @@ public final class AlertUtil { public static void switchAlert(boolean enableAlert) { isEnable = enableAlert; - if (enableAlert && UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) != null) { + } + + public static void initAlert() { + if (DbleServer.getInstance().isUseGeneralCluster() && + (ClusterController.CONFIG_MODE_UCORE.equals(ClusterGeneralConfig.getInstance().getClusterType()) || + ClusterController.CONFIG_MODE_USHARD.equals(ClusterGeneralConfig.getInstance().getClusterType()))) { alert = UcoreAlert.getInstance(); } else { alert = DEFAULT_ALERT; @@ -38,19 +44,23 @@ public final class AlertUtil { } public static void alertSelf(String code, Alert.AlertLevel level, String desc, Map labels) { - alert.alertSelf(code, level, desc, labels); + if (isEnable) { + alert.alertSelf(code, level, desc, labels); + } } public static void alert(String code, Alert.AlertLevel level, String desc, String alertComponentType, String alertComponentId, Map labels) { - alert.alert(code, level, desc, alertComponentType, alertComponentId, labels); + if (isEnable) { + alert.alert(code, level, desc, alertComponentType, alertComponentId, labels); + } } public static boolean alertResolve(String code, Alert.AlertLevel level, String alertComponentType, String alertComponentId, Map labels) { - return alert.alertResolve(code, level, alertComponentType, alertComponentId, labels); + return isEnable ? alert.alertResolve(code, level, alertComponentType, alertComponentId, labels) : true; } public static boolean alertSelfResolve(String code, Alert.AlertLevel level, Map labels) { - return alert.alertSelfResolve(code, level, labels); + return isEnable ? alert.alertSelfResolve(code, level, labels) : true; } public static Map genSingleLabel(String key, String value) { diff --git a/src/main/java/com/actiontech/dble/alarm/UcoreAlert.java b/src/main/java/com/actiontech/dble/alarm/UcoreAlert.java index e48ec0f9a..ccbc403c0 100644 --- a/src/main/java/com/actiontech/dble/alarm/UcoreAlert.java +++ b/src/main/java/com/actiontech/dble/alarm/UcoreAlert.java @@ -5,16 +5,15 @@ package com.actiontech.dble.alarm; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; +import com.actiontech.dble.cluster.bean.ClusterAlertBean; import java.util.Map; public final class UcoreAlert implements Alert { private static final String SOURCE_COMPONENT_TYPE = "dble"; - private static final String SERVER_ID = UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_SERVER_ID); - private static final String SOURCE_COMPONENT_ID = UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); private static final UcoreAlert INSTANCE = new UcoreAlert(); @@ -28,50 +27,48 @@ public final class UcoreAlert implements Alert { @Override public void alertSelf(String code, AlertLevel level, String desc, Map labels) { - alert(code, level, desc, SOURCE_COMPONENT_TYPE, SOURCE_COMPONENT_ID, labels); + alert(code, level, desc, SOURCE_COMPONENT_TYPE, ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), labels); } @Override public void alert(String code, AlertLevel level, String desc, String alertComponentType, String alertComponentId, Map labels) { - UcoreInterface.AlertInput.Builder builder = UcoreInterface.AlertInput.newBuilder(). - setCode(code). - setDesc(desc). - setLevel(level.toString()). - setSourceComponentType(SOURCE_COMPONENT_TYPE). - setSourceComponentId(SOURCE_COMPONENT_ID). - setAlertComponentId(alertComponentId). - setAlertComponentType(alertComponentType). - setServerId(SERVER_ID). - setTimestampUnix(System.currentTimeMillis() * 1000000); + ClusterAlertBean alert = new ClusterAlertBean(); + alert.setCode(code); + alert.setDesc(desc); + alert.setLevel(level.toString()); + alert.setSourceComponentType(SOURCE_COMPONENT_TYPE); + alert.setSourceComponentId(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + alert.setAlertComponentId(alertComponentId); + alert.setAlertComponentType(alertComponentType); + alert.setServerId(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_SERVER_ID)); + alert.setTimestampUnix(System.currentTimeMillis() * 1000000); if (labels != null) { - builder.putAllLabels(labels); + alert.setLabels(labels); } - UcoreInterface.AlertInput input = builder.build(); - ClusterUcoreSender.alert(input); + ClusterHelper.alert(alert); } @Override public boolean alertResolve(String code, AlertLevel level, String alertComponentType, String alertComponentId, Map labels) { - UcoreInterface.AlertInput.Builder builder = UcoreInterface.AlertInput.newBuilder(). - setCode(code). - setDesc(""). - setLevel(level.toString()). - setSourceComponentType(SOURCE_COMPONENT_TYPE). - setSourceComponentId(SOURCE_COMPONENT_ID). - setAlertComponentId(alertComponentId). - setAlertComponentType(alertComponentType). - setServerId(SERVER_ID). - setResolveTimestampUnix(System.currentTimeMillis() * 1000000); + ClusterAlertBean alert = new ClusterAlertBean(); + alert.setCode(code); + alert.setDesc(""); + alert.setLevel(level.toString()); + alert.setSourceComponentType(SOURCE_COMPONENT_TYPE); + alert.setSourceComponentId(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + alert.setAlertComponentId(alertComponentId); + alert.setAlertComponentType(alertComponentType); + alert.setServerId(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_SERVER_ID)); + alert.setResolveTimestampUnix(System.currentTimeMillis() * 1000000); if (labels != null) { - builder.putAllLabels(labels); + alert.setLabels(labels); } - UcoreInterface.AlertInput input = builder.build(); - return ClusterUcoreSender.alertResolve(input); + return ClusterHelper.alertResolve(alert); } @Override public boolean alertSelfResolve(String code, AlertLevel level, Map labels) { - return alertResolve(code, level, SOURCE_COMPONENT_TYPE, SOURCE_COMPONENT_ID, labels); + return alertResolve(code, level, SOURCE_COMPONENT_TYPE, ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), labels); } } diff --git a/src/main/java/com/actiontech/dble/backend/mysql/view/CKVStoreRepository.java b/src/main/java/com/actiontech/dble/backend/mysql/view/CKVStoreRepository.java index aa1aaa6ff..7eb81bcf5 100644 --- a/src/main/java/com/actiontech/dble/backend/mysql/view/CKVStoreRepository.java +++ b/src/main/java/com/actiontech/dble/backend/mysql/view/CKVStoreRepository.java @@ -7,12 +7,9 @@ package com.actiontech.dble.backend.mysql.view; import com.actiontech.dble.DbleServer; import com.actiontech.dble.btrace.provider.ClusterDelayProvider; -import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UDistributeLock; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; +import com.actiontech.dble.cluster.*; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.ClusterPathUtil; import com.actiontech.dble.config.model.SchemaConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,8 +48,8 @@ public class CKVStoreRepository implements Repository { @Override public void init() { - List allList = ClusterUcoreSender.getKeyTree(UcorePathUtil.getViewPath()); - for (UKvBean bean : allList) { + List allList = ClusterHelper.getKVPath(ClusterPathUtil.getViewPath()); + for (KvBean bean : allList) { String[] key = bean.getKey().split("/"); if (key.length == 5) { String[] value = key[key.length - 1].split(SCHEMA_VIEW_SPLIT); @@ -81,14 +78,14 @@ public class CKVStoreRepository implements Repository { public void put(String schemaName, String viewName, String createSql) { Map schemaMap = viewCreateSqlMap.get(schemaName); - StringBuffer sb = new StringBuffer().append(UcorePathUtil.getViewPath()). + StringBuffer sb = new StringBuffer().append(ClusterPathUtil.getViewPath()). append(SEPARATOR).append(schemaName).append(SCHEMA_VIEW_SPLIT).append(viewName); - StringBuffer lsb = new StringBuffer().append(UcorePathUtil.getViewPath()). + StringBuffer lsb = new StringBuffer().append(ClusterPathUtil.getViewPath()). append(SEPARATOR).append(LOCK).append(SEPARATOR).append(schemaName).append(SCHEMA_VIEW_SPLIT).append(viewName); - StringBuffer nsb = new StringBuffer().append(UcorePathUtil.getViewPath()). + StringBuffer nsb = new StringBuffer().append(ClusterPathUtil.getViewPath()). append(SEPARATOR).append(UPDATE).append(SEPARATOR).append(schemaName).append(SCHEMA_VIEW_SPLIT).append(viewName); - UDistributeLock distributeLock = new UDistributeLock(lsb.toString(), - UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) + SCHEMA_VIEW_SPLIT + UPDATE); + DistributeLock distributeLock = new DistributeLock(lsb.toString(), + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) + SCHEMA_VIEW_SPLIT + UPDATE); try { @@ -102,14 +99,14 @@ public class CKVStoreRepository implements Repository { ClusterDelayProvider.delayAfterGetLock(); schemaMap.put(viewName, createSql); - ClusterUcoreSender.sendDataToUcore(sb.toString(), createSql); + ClusterHelper.setKV(sb.toString(), createSql); ClusterDelayProvider.delayAfterViewSetKey(); - ClusterUcoreSender.sendDataToUcore(nsb.toString(), UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) + SCHEMA_VIEW_SPLIT + UPDATE); + ClusterHelper.setKV(nsb.toString(), ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) + SCHEMA_VIEW_SPLIT + UPDATE); ClusterDelayProvider.delayAfterViewNotic(); //self reponse set - ClusterUcoreSender.sendDataToUcore(nsb.toString() + UcorePathUtil.SEPARATOR + UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(nsb.toString() + ClusterPathUtil.SEPARATOR + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), ClusterPathUtil.SUCCESS); - String errorMsg = ClusterUcoreSender.waitingForAllTheNode(UcorePathUtil.SUCCESS, nsb.toString() + SEPARATOR); + String errorMsg = ClusterHelper.waitingForAllTheNode(ClusterPathUtil.SUCCESS, nsb.toString() + SEPARATOR); if (errorMsg != null) { throw new RuntimeException(errorMsg); @@ -124,7 +121,7 @@ public class CKVStoreRepository implements Repository { throw new RuntimeException(e); } finally { ClusterDelayProvider.beforeDeleteViewNotic(); - ClusterUcoreSender.deleteKVTree(nsb.toString() + SEPARATOR); + ClusterHelper.cleanPath(nsb.toString() + SEPARATOR); ClusterDelayProvider.beforeReleaseViewLock(); distributeLock.release(); } @@ -142,15 +139,15 @@ public class CKVStoreRepository implements Repository { */ @Override public void delete(String schemaName, String view) { - StringBuffer sb = new StringBuffer().append(UcorePathUtil.getViewPath()). + StringBuffer sb = new StringBuffer().append(ClusterPathUtil.getViewPath()). append(SEPARATOR).append(schemaName).append(SCHEMA_VIEW_SPLIT).append(view); - StringBuffer nsb = new StringBuffer().append(UcorePathUtil.getViewPath()). + StringBuffer nsb = new StringBuffer().append(ClusterPathUtil.getViewPath()). append(SEPARATOR).append(UPDATE).append(SEPARATOR). append(schemaName).append(SCHEMA_VIEW_SPLIT).append(view); - StringBuffer lsb = new StringBuffer().append(UcorePathUtil.getViewPath()). + StringBuffer lsb = new StringBuffer().append(ClusterPathUtil.getViewPath()). append(SEPARATOR).append(LOCK).append(SEPARATOR).append(schemaName).append(SCHEMA_VIEW_SPLIT).append(view); - UDistributeLock distributeLock = new UDistributeLock(lsb.toString(), - UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) + SCHEMA_VIEW_SPLIT + DELETE); + DistributeLock distributeLock = new DistributeLock(lsb.toString(), + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) + SCHEMA_VIEW_SPLIT + DELETE); try { viewCreateSqlMap.get(schemaName).remove(view); @@ -162,15 +159,15 @@ public class CKVStoreRepository implements Repository { } } ClusterDelayProvider.delayAfterGetLock(); - ClusterUcoreSender.deleteKV(sb.toString()); + ClusterHelper.cleanKV(sb.toString()); ClusterDelayProvider.delayAfterViewSetKey(); - ClusterUcoreSender.sendDataToUcore(nsb.toString(), UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) + SCHEMA_VIEW_SPLIT + DELETE); + ClusterHelper.setKV(nsb.toString(), ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID) + SCHEMA_VIEW_SPLIT + DELETE); ClusterDelayProvider.delayAfterViewNotic(); //self reponse set - ClusterUcoreSender.sendDataToUcore(nsb.toString() + UcorePathUtil.SEPARATOR + UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(nsb.toString() + ClusterPathUtil.SEPARATOR + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), ClusterPathUtil.SUCCESS); - String errorMsg = ClusterUcoreSender.waitingForAllTheNode(UcorePathUtil.SUCCESS, nsb.toString() + SEPARATOR); + String errorMsg = ClusterHelper.waitingForAllTheNode(ClusterPathUtil.SUCCESS, nsb.toString() + SEPARATOR); if (errorMsg != null) { throw new RuntimeException(errorMsg); @@ -184,7 +181,7 @@ public class CKVStoreRepository implements Repository { throw new RuntimeException(e); } finally { ClusterDelayProvider.beforeDeleteViewNotic(); - ClusterUcoreSender.deleteKVTree(nsb.toString() + SEPARATOR); + ClusterHelper.cleanPath(nsb.toString() + SEPARATOR); ClusterDelayProvider.beforeReleaseViewLock(); distributeLock.release(); } diff --git a/src/main/java/com/actiontech/dble/cluster/AbstractClusterSender.java b/src/main/java/com/actiontech/dble/cluster/AbstractClusterSender.java new file mode 100644 index 000000000..560c1270d --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/AbstractClusterSender.java @@ -0,0 +1,86 @@ +package com.actiontech.dble.cluster; + +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.kVtoXml.ClusterToXml; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.LockSupport; + +/** + * Created by szf on 2019/3/11. + */ +public abstract class AbstractClusterSender implements ClusterSender { + public static final Logger LOGGER = LoggerFactory.getLogger(AbstractClusterSender.class); + + + public String waitingForAllTheNode(String checkString, String path) { + Map expectedMap = ClusterToXml.getOnlineMap(); + StringBuffer errorMsg = new StringBuffer(); + for (; ; ) { + errorMsg.setLength(0); + if (checkResponseForOneTime(checkString, path, expectedMap, errorMsg)) { + break; + } + LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(50)); + } + return errorMsg.length() <= 0 ? null : errorMsg.toString(); + } + + public boolean checkResponseForOneTime(String checkString, String path, Map expectedMap, StringBuffer errorMsg) { + Map currentMap = ClusterToXml.getOnlineMap(); + checkOnline(expectedMap, currentMap); + List responseList = ClusterHelper.getKVPath(path); + boolean flag = false; + for (Map.Entry entry : expectedMap.entrySet()) { + flag = false; + for (KvBean kvBean : responseList) { + String responseNode = last(kvBean.getKey().split("/")); + if (last(entry.getKey().split("/")). + equals(responseNode)) { + if (checkString != null) { + if (!checkString.equals(kvBean.getValue())) { + if (errorMsg != null) { + errorMsg.append(responseNode).append(":").append(kvBean.getValue()).append(";"); + } + } + } + flag = true; + break; + } + } + if (!flag) { + break; + } + } + + return flag; + } + + + public void checkOnline(Map expectedMap, Map currentMap) { + Iterator> iterator = expectedMap.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + if (!currentMap.containsKey(entry.getKey()) || + (currentMap.containsKey(entry.getKey()) && !currentMap.get(entry.getKey()).equals(entry.getValue()))) { + iterator.remove(); + } + } + + for (Map.Entry entry : currentMap.entrySet()) { + if (!expectedMap.containsKey(entry.getKey())) { + LOGGER.warn("NODE " + entry.getKey() + " IS NOT EXPECTED TO BE ONLINE,PLEASE CHECK IT "); + } + } + } + + public static T last(T[] array) { + return array[array.length - 1]; + } + +} diff --git a/src/main/java/com/actiontech/dble/cluster/ClusterController.java b/src/main/java/com/actiontech/dble/cluster/ClusterController.java index d9cfec8d8..116f1e85e 100644 --- a/src/main/java/com/actiontech/dble/cluster/ClusterController.java +++ b/src/main/java/com/actiontech/dble/cluster/ClusterController.java @@ -5,7 +5,6 @@ package com.actiontech.dble.cluster; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; import com.actiontech.dble.config.loader.zkprocess.comm.ZkConfig; import com.actiontech.dble.util.ResourceUtil; import com.google.common.base.Strings; @@ -24,9 +23,11 @@ public final class ClusterController { private static final Logger LOGGER = LoggerFactory.getLogger(ClusterController.class); public static final String CONFIG_FILE_NAME = "/myid.properties"; - private static final String CONFIG_MODE_UCORE = "ucore"; - private static final String CONFIG_MODE_ZK = "zk"; - private static final String CONFIG_MODE_SINGLE = "false"; + public static final String CONFIG_MODE_UCORE = "ucore"; + public static final String CONFIG_MODE_USHARD = "ushard"; + public static final String CONFIG_MODE_ZK = "zk"; + public static final String CONFIG_MODE_SINGLE = "false"; + public static final String CONFIG_MODE_CUSTOMIZATION = "customization"; public static final int GRPC_SUBTIMEOUT = 70; public static final int GENERAL_GRPC_TIMEOUT = 10; @@ -37,29 +38,23 @@ public final class ClusterController { private ClusterController() { } - public static void init() { + public static ClusterGeneralConfig init() { //read from myid.properties to tall use zk or ucore try { properties = loadMyidPropersites(); - if (CONFIG_MODE_UCORE.equalsIgnoreCase(properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()))) { - checkUcoreProperties(); - UcoreConfig.initUcore(properties); - } else if (CONFIG_MODE_ZK.equalsIgnoreCase(properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()))) { - ZkConfig.initZk(properties); - } else { - LOGGER.info("No Cluster Config .......start in single mode"); - } + ClusterGeneralConfig clusterGeneralConfig = ClusterGeneralConfig.initConfig(properties); + ClusterGeneralConfig.initData(properties); + return clusterGeneralConfig; } catch (Exception e) { - LOGGER.warn("error:", e); + throw new RuntimeException(e); } - } public static void initFromShellUcore() { properties = loadMyidPropersites(); - checkClusterMode(CONFIG_MODE_UCORE); - checkUcoreProperties(); - UcoreConfig.initUcoreFromShell(properties); + ClusterGeneralConfig.initConfig(properties); + ClusterGeneralConfig.getInstance().getClusterSender().checkClusterConfig(properties); + ClusterGeneralConfig.getInstance().getClusterSender().initConInfo(properties); } public static void initFromShellZK() { @@ -98,11 +93,5 @@ public final class ClusterController { throw new RuntimeException("Cluster mode is not " + clusterMode); } } - private static void checkUcoreProperties() { - if (Strings.isNullOrEmpty(properties.getProperty(ClusterParamCfg.CLUSTER_PLUGINS_PORT.getKey())) || - Strings.isNullOrEmpty(properties.getProperty(ClusterParamCfg.CLUSTER_CFG_SERVER_ID.getKey()))) { - throw new RuntimeException("Cluster Config is not completely set"); - } - } } diff --git a/src/main/java/com/actiontech/dble/cluster/ClusterGeneralConfig.java b/src/main/java/com/actiontech/dble/cluster/ClusterGeneralConfig.java new file mode 100644 index 000000000..9096f3cd2 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/ClusterGeneralConfig.java @@ -0,0 +1,107 @@ +package com.actiontech.dble.cluster; + +import com.actiontech.dble.cluster.impl.UcoreSender; +import com.actiontech.dble.cluster.impl.ushard.UshardSender; +import com.actiontech.dble.cluster.kVtoXml.ClusterToXml; +import com.actiontech.dble.config.loader.zkprocess.comm.ZkConfig; + +import java.util.Properties; + +import static com.actiontech.dble.backend.mysql.nio.handler.ResetConnHandler.LOGGER; +import static com.actiontech.dble.cluster.ClusterController.*; + +/** + * Created by szf on 2019/3/11. + */ +public final class ClusterGeneralConfig { + + private static final ClusterGeneralConfig INSTANCE = new ClusterGeneralConfig(); + private boolean useCluster = false; + private AbstractClusterSender clusterSender = null; + private Properties properties = null; + private String clusterType = null; + + private ClusterGeneralConfig() { + + } + + public static ClusterGeneralConfig initConfig(Properties properties) { + INSTANCE.properties = properties; + + if (CONFIG_MODE_USHARD.equalsIgnoreCase(properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()))) { + INSTANCE.clusterSender = new UshardSender(); + INSTANCE.useCluster = true; + INSTANCE.clusterType = CONFIG_MODE_USHARD; + } else if (CONFIG_MODE_UCORE.equalsIgnoreCase(properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()))) { + INSTANCE.clusterSender = new UcoreSender(); + INSTANCE.useCluster = true; + INSTANCE.clusterType = CONFIG_MODE_UCORE; + } else if (CONFIG_MODE_ZK.equalsIgnoreCase(properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()))) { + INSTANCE.useCluster = true; + INSTANCE.clusterType = CONFIG_MODE_ZK; + } else if (CONFIG_MODE_SINGLE.equalsIgnoreCase(properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()))) { + LOGGER.info("No Cluster Config .......start in single mode"); + } else { + try { + String clazz = properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()); + INSTANCE.useCluster = true; + INSTANCE.clusterType = CONFIG_MODE_CUSTOMIZATION; + Class clz = Class.forName(clazz); + //all function must be extend from AbstractPartitionAlgorithm + if (!AbstractClusterSender.class.isAssignableFrom(clz)) { + throw new IllegalArgumentException("No ClusterSender AS " + clazz); + } + INSTANCE.clusterSender = (AbstractClusterSender) clz.newInstance(); + } catch (Exception e) { + throw new RuntimeException("Get error when try to create " + properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey())); + } + } + return INSTANCE; + } + + + public static void initData(Properties properties) { + if (CONFIG_MODE_ZK.equalsIgnoreCase(properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()))) { + ZkConfig.initZk(properties); + } else if (CONFIG_MODE_SINGLE.equalsIgnoreCase(properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey()))) { + LOGGER.info("No Cluster Config .......start in single mode"); + } else { + try { + INSTANCE.clusterSender.checkClusterConfig(properties); + INSTANCE.clusterSender.initCluster(properties); + ClusterToXml.loadKVtoFile(); + } catch (Exception e) { + throw new RuntimeException("Get error when try to create " + properties.getProperty(ClusterParamCfg.CLUSTER_FLAG.getKey())); + } + } + } + + + public AbstractClusterSender getClusterSender() { + return clusterSender; + } + + public void setClusterSender(AbstractClusterSender clusterSender) { + this.clusterSender = clusterSender; + } + + public boolean isUseCluster() { + return useCluster; + } + + public String getClusterType() { + return clusterType; + } + + public static ClusterGeneralConfig getInstance() { + return INSTANCE; + } + + public String getValue(ClusterParamCfg param) { + if (properties != null && null != param) { + return properties.getProperty(param.getKey()); + } + return null; + } + +} diff --git a/src/main/java/com/actiontech/dble/cluster/ClusterHelper.java b/src/main/java/com/actiontech/dble/cluster/ClusterHelper.java new file mode 100644 index 000000000..8ecb128a4 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/ClusterHelper.java @@ -0,0 +1,69 @@ +package com.actiontech.dble.cluster; + +import com.actiontech.dble.cluster.bean.ClusterAlertBean; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.bean.SubscribeRequest; +import com.actiontech.dble.cluster.bean.SubscribeReturnBean; + +import java.util.List; +import java.util.Map; + +/** + * Created by szf on 2019/3/11. + */ +public final class ClusterHelper { + + private ClusterHelper() { + + } + + public static String lock(String path, String value) throws Exception { + return ClusterGeneralConfig.getInstance().getClusterSender().lock(path, value); + } + + public static void unlockKey(String path, String sessionId) { + ClusterGeneralConfig.getInstance().getClusterSender().unlockKey(path, sessionId); + } + + public static void setKV(String path, String value) throws Exception { + ClusterGeneralConfig.getInstance().getClusterSender().setKV(path, value); + } + + public static KvBean getKV(String path) { + return ClusterGeneralConfig.getInstance().getClusterSender().getKV(path); + } + + public static void cleanKV(String path) { + ClusterGeneralConfig.getInstance().getClusterSender().cleanKV(path); + } + + public static List getKVPath(String path) { + return ClusterGeneralConfig.getInstance().getClusterSender().getKVPath(path); + } + + public static void cleanPath(String path) { + ClusterGeneralConfig.getInstance().getClusterSender().cleanPath(path); + } + + public static boolean checkResponseForOneTime(String checkString, String path, Map expectedMap, StringBuffer errorMsg) { + return ClusterGeneralConfig.getInstance().getClusterSender().checkResponseForOneTime(checkString, path, expectedMap, errorMsg); + } + + public static String waitingForAllTheNode(String checkString, String path) { + return ClusterGeneralConfig.getInstance().getClusterSender().waitingForAllTheNode(checkString, path); + } + + public static void alert(ClusterAlertBean alert) { + ClusterGeneralConfig.getInstance().getClusterSender().alert(alert); + } + + public static boolean alertResolve(ClusterAlertBean alert) { + return ClusterGeneralConfig.getInstance().getClusterSender().alertResolve(alert); + } + + public static SubscribeReturnBean subscribeKvPrefix(SubscribeRequest request) throws Exception { + return ClusterGeneralConfig.getInstance().getClusterSender().subscribeKvPrefix(request); + } + + +} diff --git a/src/main/java/com/actiontech/dble/cluster/ClusterParamCfg.java b/src/main/java/com/actiontech/dble/cluster/ClusterParamCfg.java index a54070d20..5d4053b67 100644 --- a/src/main/java/com/actiontech/dble/cluster/ClusterParamCfg.java +++ b/src/main/java/com/actiontech/dble/cluster/ClusterParamCfg.java @@ -29,6 +29,12 @@ public enum ClusterParamCfg { */ CLUSTER_CFG_CLUSTERID("clusterId"), + + /** + * node id + */ + CLUSTER_CFG_ROOT("rootPath"), + /** * node id */ diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcorePathUtil.java b/src/main/java/com/actiontech/dble/cluster/ClusterPathUtil.java similarity index 86% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcorePathUtil.java rename to src/main/java/com/actiontech/dble/cluster/ClusterPathUtil.java index 1522d76e4..98332309f 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcorePathUtil.java +++ b/src/main/java/com/actiontech/dble/cluster/ClusterPathUtil.java @@ -3,15 +3,14 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess; +package com.actiontech.dble.cluster; -import com.actiontech.dble.cluster.ClusterParamCfg; import com.actiontech.dble.config.Versions; /** * Created by szf on 2018/1/26. */ -public final class UcorePathUtil { +public final class ClusterPathUtil { public static final String UCORE_LOCAL_WRITE_PATH = "./"; @@ -19,9 +18,9 @@ public final class UcorePathUtil { public static final String DATA_HOST = "dataHost"; public static final String DATA_NODE = "dataNode"; public static final String SEPARATOR = "/"; - private static final String ROOT_PATH = "universe" + SEPARATOR + Versions.ROOT_PREFIX; + private static final String ROOT_PATH = ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_ROOT) != null ? ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_ROOT) : "universe" + SEPARATOR + Versions.ROOT_PREFIX; - public static final String BASE_PATH = ROOT_PATH + SEPARATOR + UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_CLUSTERID) + SEPARATOR; + public static final String BASE_PATH = ROOT_PATH + SEPARATOR + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_CLUSTERID) + SEPARATOR; public static final String SUCCESS = "success"; @@ -67,7 +66,7 @@ public final class UcorePathUtil { public static final String EHCACHE_NAME = "ehcache.xml"; public static final String EHCACHE = "ehcache"; - private UcorePathUtil() { + private ClusterPathUtil() { } @@ -104,7 +103,7 @@ public final class UcorePathUtil { } public static String getSelfConfStatusPath() { - return CONF_BASE_PATH + CONF_STATUS + SEPARATOR + UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + return CONF_BASE_PATH + CONF_STATUS + SEPARATOR + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); } //depth:2,child node of base_path @@ -129,7 +128,7 @@ public final class UcorePathUtil { } public static String getBinlogPauseStatusSelf() { - return getBinlogPauseStatus() + SEPARATOR + UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + return getBinlogPauseStatus() + SEPARATOR + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); } //depth:2,child node of base_path @@ -165,7 +164,7 @@ public final class UcorePathUtil { //depth:2,child node of base_path public static String getDDLInstancePath(String fullName) { - return BASE_PATH + "ddl" + SEPARATOR + fullName + SEPARATOR + UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + return BASE_PATH + "ddl" + SEPARATOR + fullName + SEPARATOR + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); } public static String getViewPath() { diff --git a/src/main/java/com/actiontech/dble/cluster/ClusterSender.java b/src/main/java/com/actiontech/dble/cluster/ClusterSender.java new file mode 100644 index 000000000..929413386 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/ClusterSender.java @@ -0,0 +1,124 @@ +package com.actiontech.dble.cluster; + +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.bean.ClusterAlertBean; +import com.actiontech.dble.cluster.bean.SubscribeRequest; +import com.actiontech.dble.cluster.bean.SubscribeReturnBean; + +import java.util.List; +import java.util.Properties; + +/** + * Created by szf on 2019/3/11. + */ +public interface ClusterSender { + + /** + * only init the connection preperties for the clusterSender + * mainly used by shell to upload xml config + * do not start any Thread in this function! + * + * @param ucoreProperties + */ + void initConInfo(Properties ucoreProperties); + + /** + * general config init of clusterSender + * There are several task may be start + * 1 init the config + * 2 start customized connection controller + * + * @param properties + */ + void initCluster(Properties properties); + + /** + * lock a path,so that other DbleServer in cluster can not hold the path in the same time + * return sessionId of the lock,if the return String is not null or "" means lock success + * the lock value is also import ,the lock also need to be regarded as a KV + *

+ * NOTICE: the lock should only influences it self,the child path should be available to other DbleServer to write + * + * @param path + * @param value + * @return + * @throws Exception + */ + String lock(String path, String value) throws Exception; + + + /** + * use the locked path and sessionId to unlock a path + * and the KV of the lock should be removed + * + * @param key + * @param sessionId + */ + void unlockKey(String key, String sessionId); + + /** + * put KV into cluster + * + * @param path + * @param value + * @throws Exception + */ + void setKV(String path, String value) throws Exception; + + /** + * get KV from cluster + * + * @param path + * @return + */ + KvBean getKV(String path); + + /** + * return all the KV under the path + *

+ * NOTICE: the KV in result list should be full path + * + * @param path + * @return + */ + List getKVPath(String path); + + /** + * clean/delete all the KV under the path + * NOTICE: path itself also need cleaned + * + * @param path + */ + void cleanPath(String path); + + /** + * clean/delete single KV + * + * @param path + */ + void cleanKV(String path); + + SubscribeReturnBean subscribeKvPrefix(SubscribeRequest request) throws Exception; + + /** + * alert something into cluster + * + * @param alert + */ + void alert(ClusterAlertBean alert); + + /** + * notify cluster some alert is resolved + * + * @param alert + * @return + */ + boolean alertResolve(ClusterAlertBean alert); + + /** + * check if the cluster config is complete,if not throw a RunTimeException + * + * @param properties + */ + void checkClusterConfig(Properties properties); +} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UDistrbtLockManager.java b/src/main/java/com/actiontech/dble/cluster/DistrbtLockManager.java similarity index 50% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UDistrbtLockManager.java rename to src/main/java/com/actiontech/dble/cluster/DistrbtLockManager.java index c132c5042..34b25979c 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UDistrbtLockManager.java +++ b/src/main/java/com/actiontech/dble/cluster/DistrbtLockManager.java @@ -3,30 +3,30 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess; +package com.actiontech.dble.cluster; import java.util.HashMap; import java.util.Map; /** * Created by szf on 2018/3/6. - * this class is save the UDistributeLock when ddl executed + * this class is save the DistributeLock when ddl executed */ -public final class UDistrbtLockManager { +public final class DistrbtLockManager { - private final Map lockTables; - private static final UDistrbtLockManager INSTANCE = new UDistrbtLockManager(); + private final Map lockTables; + private static final DistrbtLockManager INSTANCE = new DistrbtLockManager(); - private UDistrbtLockManager() { + private DistrbtLockManager() { this.lockTables = new HashMap<>(); } - public static void addLock(UDistributeLock lock) { + public static void addLock(DistributeLock lock) { INSTANCE.lockTables.put(lock.getPath(), lock); } public static void releaseLock(String path) { - UDistributeLock removedLock = INSTANCE.lockTables.remove(path); + DistributeLock removedLock = INSTANCE.lockTables.remove(path); if (removedLock != null) { removedLock.release(); } diff --git a/src/main/java/com/actiontech/dble/cluster/DistributeLock.java b/src/main/java/com/actiontech/dble/cluster/DistributeLock.java new file mode 100644 index 000000000..5057c3170 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/DistributeLock.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2016-2019 ActionTech. + * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. + */ + +package com.actiontech.dble.cluster; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Created by szf on 2018/1/31. + */ +public class DistributeLock { + + protected static final Logger LOGGER = LoggerFactory.getLogger(DistributeLock.class); + private final int maxErrorCnt; + private int errorCount = 0; + private String path; + private String value; + private String session; + + //private Thread renewThread; + + public DistributeLock(String path, String value) { + this.path = path; + this.value = value; + this.maxErrorCnt = 3; + } + + public DistributeLock(String path, String value, int maxErrorCnt) { + this.path = path; + this.value = value; + this.maxErrorCnt = maxErrorCnt; + } + + + public void release() { + if (session != null) { + ClusterHelper.unlockKey(path, session); + } + } + + public boolean acquire() { + try { + String sessionId = ClusterHelper.lock(this.path, value); + if ("".equals(sessionId)) { + errorCount++; + if (errorCount == maxErrorCnt) { + throw new RuntimeException(" get lock from ucore error,ucore maybe offline "); + } + return false; + } + session = sessionId; + errorCount = 0; + } catch (Exception e) { + LOGGER.warn(" get lock from ucore error", e); + errorCount++; + if (errorCount == maxErrorCnt) { + throw new RuntimeException(" get lock from ucore error,ucore maybe offline "); + } + return false; + } + return true; + } + + public String getPath() { + return path; + } +} diff --git a/src/main/java/com/actiontech/dble/cluster/bean/ClusterAlertBean.java b/src/main/java/com/actiontech/dble/cluster/bean/ClusterAlertBean.java new file mode 100644 index 000000000..ab9621648 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/bean/ClusterAlertBean.java @@ -0,0 +1,109 @@ +package com.actiontech.dble.cluster.bean; + +import java.util.Map; + +/** + * Created by szf on 2019/3/11. + */ +public class ClusterAlertBean { + String code; + String level; + String desc; + String sourceComponentType; + String sourceComponentId; + String alertComponentType; + String alertComponentId; + String serverId; + long timestampUnix; + long resolveTimestampUnix; + + public Map getLabels() { + return labels; + } + + public void setLabels(Map labels) { + this.labels = labels; + } + + Map labels; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public String getSourceComponentType() { + return sourceComponentType; + } + + public void setSourceComponentType(String sourceComponentType) { + this.sourceComponentType = sourceComponentType; + } + + public String getSourceComponentId() { + return sourceComponentId; + } + + public void setSourceComponentId(String sourceComponentId) { + this.sourceComponentId = sourceComponentId; + } + + public String getAlertComponentType() { + return alertComponentType; + } + + public void setAlertComponentType(String alertComponentType) { + this.alertComponentType = alertComponentType; + } + + public String getAlertComponentId() { + return alertComponentId; + } + + public void setAlertComponentId(String alertComponentId) { + this.alertComponentId = alertComponentId; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public long getTimestampUnix() { + return timestampUnix; + } + + public void setTimestampUnix(long timestampUnix) { + this.timestampUnix = timestampUnix; + } + + public long getResolveTimestampUnix() { + return resolveTimestampUnix; + } + + public void setResolveTimestampUnix(long resolveTimestampUnix) { + this.resolveTimestampUnix = resolveTimestampUnix; + } +} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/bean/UKvBean.java b/src/main/java/com/actiontech/dble/cluster/bean/KvBean.java similarity index 83% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/bean/UKvBean.java rename to src/main/java/com/actiontech/dble/cluster/bean/KvBean.java index 908fca200..2fc36d658 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/bean/UKvBean.java +++ b/src/main/java/com/actiontech/dble/cluster/bean/KvBean.java @@ -3,12 +3,12 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.bean; +package com.actiontech.dble.cluster.bean; /** * Created by szf on 2018/1/31. */ -public class UKvBean { +public class KvBean { public static final String DELETE = "delete"; public static final String UPDATE = "update"; @@ -20,17 +20,17 @@ public class UKvBean { private String changeType; private long index; - public UKvBean() { + public KvBean() { } - public UKvBean(String key, String value, long index) { + public KvBean(String key, String value, long index) { this.key = key; this.value = value; this.index = index; } - public UKvBean(String key, String value, String changeType) { + public KvBean(String key, String value, String changeType) { this.key = key; this.value = value; this.changeType = changeType; diff --git a/src/main/java/com/actiontech/dble/cluster/bean/SubscribeRequest.java b/src/main/java/com/actiontech/dble/cluster/bean/SubscribeRequest.java new file mode 100644 index 000000000..65f930266 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/bean/SubscribeRequest.java @@ -0,0 +1,36 @@ +package com.actiontech.dble.cluster.bean; + +/** + * Created by szf on 2019/3/12. + */ +public class SubscribeRequest { + private long index; + private int duration; + private String path; + + + public long getIndex() { + return index; + } + + public void setIndex(long index) { + this.index = index; + } + + public int getDuration() { + return duration; + } + + public void setDuration(int duration) { + this.duration = duration; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + +} diff --git a/src/main/java/com/actiontech/dble/cluster/bean/SubscribeReturnBean.java b/src/main/java/com/actiontech/dble/cluster/bean/SubscribeReturnBean.java new file mode 100644 index 000000000..0f6f6a15c --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/bean/SubscribeReturnBean.java @@ -0,0 +1,44 @@ +package com.actiontech.dble.cluster.bean; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by szf on 2019/3/12. + */ +public class SubscribeReturnBean { + + + private List kvList = new ArrayList<>(); + + private long index = 0; + + public int getKeysCount() { + return kvList.size(); + } + + public String getKeys(int i) { + return kvList.get(i).getKey(); + } + + public String getValues(int i) { + return kvList.get(i).getValue(); + } + + public List getKvList() { + return kvList; + } + + public void setKvList(List kvList) { + this.kvList = kvList; + } + + public long getIndex() { + return index; + } + + public void setIndex(long index) { + this.index = index; + } + +} diff --git a/src/main/java/com/actiontech/dble/cluster/impl/UcoreSender.java b/src/main/java/com/actiontech/dble/cluster/impl/UcoreSender.java new file mode 100644 index 000000000..d11685095 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/impl/UcoreSender.java @@ -0,0 +1,561 @@ +/* + * Copyright (C) 2016-2019 ActionTech. + * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. + */ + +package com.actiontech.dble.cluster.impl; + +import com.actiontech.dble.DbleServer; +import com.actiontech.dble.alarm.UcoreGrpc; +import com.actiontech.dble.alarm.UcoreInterface; +import com.actiontech.dble.backend.mysql.view.CKVStoreRepository; +import com.actiontech.dble.backend.mysql.view.FileSystemRepository; +import com.actiontech.dble.backend.mysql.view.Repository; +import com.actiontech.dble.cluster.AbstractClusterSender; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; +import com.actiontech.dble.cluster.ClusterParamCfg; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.bean.ClusterAlertBean; +import com.actiontech.dble.cluster.bean.SubscribeRequest; +import com.actiontech.dble.cluster.bean.SubscribeReturnBean; +import com.actiontech.dble.server.status.OnlineLockStatus; +import org.apache.commons.lang.StringUtils; +import com.google.common.base.Strings; +import io.grpc.Channel; +import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.LockSupport; + +import static com.actiontech.dble.cluster.ClusterController.CONFIG_FILE_NAME; +import static com.actiontech.dble.cluster.ClusterController.GENERAL_GRPC_TIMEOUT; +import static com.actiontech.dble.cluster.ClusterController.GRPC_SUBTIMEOUT; + + +/** + * Created by szf on 2018/1/26. + */ +public final class UcoreSender extends AbstractClusterSender { + + + private volatile UcoreGrpc.UcoreBlockingStub stub = null; + private ConcurrentHashMap lockMap = new ConcurrentHashMap<>(); + private Properties properties; + private List ipList = new ArrayList<>(); + private static final String SOURCE_COMPONENT_TYPE = "dble"; + private String serverId = null; + private String sourceComponentId = null; + + + @Override + public void initConInfo(Properties ucoreProperties) { + this.properties = ucoreProperties; + serverId = getValue(ClusterParamCfg.CLUSTER_CFG_SERVER_ID); + sourceComponentId = getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + try { + for (String ip : properties.getProperty(ClusterParamCfg.CLUSTER_PLUGINS_IP.getKey()).split(",")) { + ipList.add(ip); + } + } catch (Exception e) { + LOGGER.error("error:", e); + } + Channel channel = ManagedChannelBuilder.forAddress(getIpList().get(0), + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + } + + @Override + public void initCluster(Properties ucoreProperties) { + this.properties = ucoreProperties; + serverId = getValue(ClusterParamCfg.CLUSTER_CFG_SERVER_ID); + sourceComponentId = getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + try { + for (String ip : properties.getProperty(ClusterParamCfg.CLUSTER_PLUGINS_IP.getKey()).split(",")) { + ipList.add(ip); + } + } catch (Exception e) { + LOGGER.error("error:", e); + } + Channel channel = ManagedChannelBuilder.forAddress(getIpList().get(0), + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + startUpdateNodes(); + } + + @Override + public String lock(String path, String value) throws Exception { + UcoreInterface.LockOnSessionInput input = UcoreInterface.LockOnSessionInput.newBuilder().setKey(path).setValue(value).setTTLSeconds(30).build(); + UcoreInterface.LockOnSessionOutput output; + + try { + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).lockOnSession(input); + if (!"".equals(output.getSessionId())) { + final String session = output.getSessionId(); + Thread renewThread = new Thread(new Runnable() { + @Override + public void run() { + String sessionId = session; + while (!Thread.currentThread().isInterrupted()) { + try { + LOGGER.debug("renew lock of session start:" + sessionId + " " + path); + if ("".equals(ClusterHelper.getKV(path).getValue())) { + LOGGER.warn("renew lock of session failure:" + sessionId + " " + path + ", the key is missing "); + // alert + Thread.currentThread().interrupt(); + } else if (!renewLock(sessionId)) { + LOGGER.warn("renew lock of session failure:" + sessionId + " " + path); + // alert + } else { + LOGGER.debug("renew lock of session success:" + sessionId + " " + path); + } + LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10000)); + } catch (Exception e) { + LOGGER.warn("renew lock of session failure:" + sessionId + " " + path, e); + LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(5000)); + } + } + } + }); + lockMap.put(path, renewThread); + renewThread.setName("UCORE_RENEW_" + path); + renewThread.start(); + } + return output.getSessionId(); + } catch (Exception e1) { + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).lockOnSession(input); + return output.getSessionId(); + } catch (Exception e2) { + LOGGER.info("connect to ucore error ", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + } + throw new IOException("ALL the ucore connect failure"); + } + + @Override + public void unlockKey(String path, String sessionId) { + UcoreInterface.UnlockOnSessionInput put = UcoreInterface.UnlockOnSessionInput.newBuilder().setKey(path).setSessionId(sessionId).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).unlockOnSession(put); + Thread renewThread = lockMap.get(path); + if (renewThread != null) { + renewThread.interrupt(); + } + } catch (Exception e) { + LOGGER.info(sessionId + " unlockKey " + path + " error ," + stub, e); + } + } + + @Override + public void setKV(String path, String value) throws Exception { + UcoreInterface.PutKvInput input = UcoreInterface.PutKvInput.newBuilder().setKey(path).setValue(value).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).putKv(input); + } catch (Exception e1) { + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).putKv(input); + return; + } catch (Exception e2) { + LOGGER.info("connect to ucore error ", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + throw new IOException("ALL the ucore connect failure"); + } + } + + @Override + public KvBean getKV(String path) { + UcoreInterface.GetKvInput input = UcoreInterface.GetKvInput.newBuilder().setKey(path).build(); + UcoreInterface.GetKvOutput output = null; + + try { + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKv(input); + } catch (Exception e1) { + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKv(input); + } catch (Exception e2) { + LOGGER.info("connect to ucore error ", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + if (output == null) { + throw new RuntimeException("ALL the ucore connect failure"); + } + } + + KvBean bean = new KvBean(path, output.getValue(), 0); + return bean; + } + + @Override + public List getKVPath(String path) { + if (!(path.charAt(path.length() - 1) == '/')) { + path = path + "/"; + } + List result = new ArrayList(); + UcoreInterface.GetKvTreeInput input = UcoreInterface.GetKvTreeInput.newBuilder().setKey(path).build(); + + UcoreInterface.GetKvTreeOutput output = null; + + try { + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKvTree(input); + } catch (Exception e1) { + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKvTree(input); + } catch (Exception e2) { + LOGGER.info("connect to ucore error ", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + if (output == null) { + throw new RuntimeException("ALL the ucore connect failure"); + } + } + + for (int i = 0; i < output.getKeysCount(); i++) { + KvBean bean = new KvBean(output.getKeys(i), output.getValues(i), output.getIndex()); + result.add(bean); + } + return result; + } + + @Override + public void cleanPath(String path) { + if (!(path.charAt(path.length() - 1) == '/')) { + path = path + "/"; + } + UcoreInterface.DeleteKvTreeInput input = UcoreInterface.DeleteKvTreeInput.newBuilder().setKey(path).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKvTree(input); + } catch (Exception e1) { + boolean flag = false; + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKvTree(input); + flag = true; + } catch (Exception e2) { + LOGGER.info("connect to ucore error ", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + if (!flag) { + throw new RuntimeException("ALL the ucore connect failure"); + } + } + cleanKV(path.substring(0, path.length() - 1)); + } + + public void cleanKV(String path) { + UcoreInterface.DeleteKvInput input = UcoreInterface.DeleteKvInput.newBuilder().setKey(path).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKv(input); + } catch (Exception e1) { + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKv(input); + return; + } catch (Exception e2) { + LOGGER.info("connect to ucore error ", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + throw new RuntimeException("ALL the ucore connect failure"); + } + } + + @Override + public SubscribeReturnBean subscribeKvPrefix(SubscribeRequest request) throws Exception { + + UcoreInterface.SubscribeKvPrefixInput input = UcoreInterface.SubscribeKvPrefixInput.newBuilder(). + setIndex(request.getIndex()).setDuration(request.getDuration()).setKeyPrefix(request.getPath()).build(); + try { + UcoreInterface.SubscribeKvPrefixOutput output = stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeKvPrefix(input); + return groupSubscribeResult(output); + } catch (Exception e1) { + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS); + UcoreInterface.SubscribeKvPrefixOutput output = stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeKvPrefix(input); + return groupSubscribeResult(output); + + } catch (Exception e2) { + LOGGER.info("connect to ucore at " + ip + " failure", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + } + throw new IOException("ALL the ucore connect failure"); + } + + @Override + public void alert(ClusterAlertBean alert) { + UcoreInterface.AlertInput input = getInput(alert); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alert(input); + } catch (Exception e) { + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alert(input); + return; + } catch (Exception e2) { + LOGGER.info("alert to ucore error ", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + } + } + + @Override + public boolean alertResolve(ClusterAlertBean alert) { + UcoreInterface.AlertInput input = getInput(alert); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alertResolve(input); + return true; + } catch (Exception e) { + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alertResolve(input); + return true; + } catch (Exception e2) { + LOGGER.info("alertResolve to ucore error ", e2); + if (channel != null) { + channel.shutdownNow(); + } + return false; + } + } + return false; + } + } + + @Override + public void checkClusterConfig(Properties ucoreProperties) { + if (Strings.isNullOrEmpty(ucoreProperties.getProperty(ClusterParamCfg.CLUSTER_PLUGINS_PORT.getKey())) || + Strings.isNullOrEmpty(ucoreProperties.getProperty(ClusterParamCfg.CLUSTER_CFG_SERVER_ID.getKey()))) { + throw new RuntimeException("Cluster Config is not completely set"); + } + } + + private UcoreInterface.AlertInput getInput(ClusterAlertBean alert) { + UcoreInterface.AlertInput.Builder builder = UcoreInterface.AlertInput.newBuilder(). + setCode(alert.getCode()). + setDesc(alert.getDesc()). + setLevel(alert.getLevel().toString()). + setSourceComponentType(SOURCE_COMPONENT_TYPE). + setSourceComponentId(sourceComponentId). + setAlertComponentId(alert.getAlertComponentId()). + setAlertComponentType(alert.getAlertComponentType()). + setServerId(serverId). + setTimestampUnix(System.currentTimeMillis() * 1000000); + if (alert.getLabels() != null) { + builder.putAllLabels(alert.getLabels()); + } + return builder.build(); + } + + + public boolean renewLock(String sessionId) throws Exception { + UcoreInterface.RenewSessionInput input = UcoreInterface.RenewSessionInput.newBuilder().setSessionId(sessionId).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).renewSession(input); + return true; + } catch (Exception e1) { + LOGGER.info("connect to ucore renew error and will retry"); + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).renewSession(input); + return true; + } catch (Exception e2) { + LOGGER.info("connect to ucore renew error " + stub, e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + return false; + } + } + + public SubscribeReturnBean groupSubscribeResult(UcoreInterface.SubscribeKvPrefixOutput output) { + SubscribeReturnBean result = new SubscribeReturnBean(); + result.setIndex(output.getIndex()); + if (output.getKeysCount() > 0) { + List kvList = new ArrayList<>(); + for (int i = 0; i < output.getKeysCount(); i++) { + kvList.add(new KvBean(output.getKeys(i), output.getValues(i), 0)); + } + result.setKvList(kvList); + } + return result; + } + + public UcoreInterface.SubscribeNodesOutput subscribeNodes(UcoreInterface.SubscribeNodesInput subscribeNodesInput) throws IOException { + try { + return stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeNodes(subscribeNodesInput); + } catch (Exception e) { + //the first try failure ,try for all the other ucore ip + for (String ip : getIpList()) { + ManagedChannel channel = null; + try { + channel = ManagedChannelBuilder.forAddress(ip, + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS); + return stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeNodes(subscribeNodesInput); + } catch (Exception e2) { + LOGGER.info("try connection IP " + ip + " failure ", e2); + if (channel != null) { + channel.shutdownNow(); + } + } + } + } + throw new IOException("ALL the ucore connect failure"); + } + + + public void setIp(String ips) { + properties.setProperty(ClusterParamCfg.CLUSTER_PLUGINS_IP.getKey(), ips); + FileOutputStream out = null; + try { + File file = new File(DbleServer.class.getResource(CONFIG_FILE_NAME).getFile()); + out = new FileOutputStream(file); + properties.store(out, ""); + } catch (Exception e) { + LOGGER.info("ips set to ucore failure"); + } finally { + try { + out.close(); + } catch (Exception e) { + LOGGER.info("open file error"); + } + } + } + + private void startUpdateNodes() { + Thread nodes = new Thread(new Runnable() { + @Override + public void run() { + long index = 0; + for (; ; ) { + try { + UcoreInterface.SubscribeNodesInput subscribeNodesInput = UcoreInterface.SubscribeNodesInput.newBuilder(). + setDuration(60).setIndex(index).build(); + UcoreInterface.SubscribeNodesOutput output = subscribeNodes(subscribeNodesInput); + if (index != output.getIndex()) { + index = output.getIndex(); + List ips = new ArrayList<>(); + for (int i = 0; i < output.getIpsList().size(); i++) { + ips.add(output.getIps(i)); + } + setIpList(ips); + setIp(StringUtils.join(ips, ',')); + } + + if (DbleServer.getInstance().getTmManager() != null) { + if (DbleServer.getInstance().getTmManager().getRepository() instanceof FileSystemRepository) { + LOGGER.warn("Dble first reconnect to ucore ,local view repository change to CKVStoreRepository"); + Repository newViewRepository = new CKVStoreRepository(); + DbleServer.getInstance().getTmManager().setRepository(newViewRepository); + Map> viewCreateSqlMap = newViewRepository.getViewCreateSqlMap(); + DbleServer.getInstance().getTmManager().reloadViewMeta(viewCreateSqlMap); + //init online status + LOGGER.warn("Dble first reconnect to ucore ,online status rebuild"); + OnlineLockStatus.getInstance().metaUcoreInit(true); + } + } + } catch (Exception e) { + LOGGER.warn("error in ucore nodes watch,try for another time", e); + } + } + } + }); + nodes.setName("NODES_UCORE_LISTENER"); + nodes.start(); + } + + private void setIpList(List ipList) { + this.ipList = ipList; + } + + private List getIpList() { + return ipList; + } + + + public String getValue(ClusterParamCfg param) { + if (properties != null && null != param) { + return properties.getProperty(param.getKey()); + } + return null; + } +} diff --git a/src/main/java/com/actiontech/dble/cluster/impl/ushard/DbleClusterGrpc.java b/src/main/java/com/actiontech/dble/cluster/impl/ushard/DbleClusterGrpc.java new file mode 100644 index 000000000..27cf5adef --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/impl/ushard/DbleClusterGrpc.java @@ -0,0 +1,783 @@ +package com.actiontech.dble.cluster.impl.ushard; + +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; +import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; +import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; +import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; +import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; + +/** + */ +@javax.annotation.Generated( + value = "by gRPC proto compiler (version 1.4.0)", + comments = "Source: dbleCluster.proto") +public final class DbleClusterGrpc { + + private DbleClusterGrpc() {} + + public static final String SERVICE_NAME = "ushard.DbleCluster"; + + // Static method descriptors that strictly reflect the proto. + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_PUT_KV = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "PutKv")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_GET_KV = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "GetKv")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_DELETE_KV = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "DeleteKv")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_DELETE_KV_TREE = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "DeleteKvTree")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_SUBSCRIBE_KV_PREFIX = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "SubscribeKvPrefix")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_GET_KV_TREE = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "GetKvTree")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_ALERT = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "Alert")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_ALERT_RESOLVE = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "AlertResolve")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_LOCK_ON_SESSION = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "LockOnSession")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_RENEW_SESSION = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "RenewSession")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance())) + .build(); + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static final io.grpc.MethodDescriptor METHOD_UNLOCK_ON_SESSION = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "ushard.DbleCluster", "UnlockOnSession")) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance())) + .build(); + + /** + * Creates a new async stub that supports all call types for the service + */ + public static DbleClusterStub newStub(io.grpc.Channel channel) { + return new DbleClusterStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static DbleClusterBlockingStub newBlockingStub( + io.grpc.Channel channel) { + return new DbleClusterBlockingStub(channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service + */ + public static DbleClusterFutureStub newFutureStub( + io.grpc.Channel channel) { + return new DbleClusterFutureStub(channel); + } + + /** + */ + public static abstract class DbleClusterImplBase implements io.grpc.BindableService { + + /** + */ + public void putKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_PUT_KV, responseObserver); + } + + /** + */ + public void getKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_GET_KV, responseObserver); + } + + /** + */ + public void deleteKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_DELETE_KV, responseObserver); + } + + /** + */ + public void deleteKvTree(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_DELETE_KV_TREE, responseObserver); + } + + /** + */ + public void subscribeKvPrefix(com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_SUBSCRIBE_KV_PREFIX, responseObserver); + } + + /** + */ + public void getKvTree(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_GET_KV_TREE, responseObserver); + } + + /** + */ + public void alert(com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_ALERT, responseObserver); + } + + /** + */ + public void alertResolve(com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_ALERT_RESOLVE, responseObserver); + } + + /** + */ + public void lockOnSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_LOCK_ON_SESSION, responseObserver); + } + + /** + */ + public void renewSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_RENEW_SESSION, responseObserver); + } + + /** + */ + public void unlockOnSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(METHOD_UNLOCK_ON_SESSION, responseObserver); + } + + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + METHOD_PUT_KV, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty>( + this, METHODID_PUT_KV))) + .addMethod( + METHOD_GET_KV, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput>( + this, METHODID_GET_KV))) + .addMethod( + METHOD_DELETE_KV, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty>( + this, METHODID_DELETE_KV))) + .addMethod( + METHOD_DELETE_KV_TREE, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty>( + this, METHODID_DELETE_KV_TREE))) + .addMethod( + METHOD_SUBSCRIBE_KV_PREFIX, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput>( + this, METHODID_SUBSCRIBE_KV_PREFIX))) + .addMethod( + METHOD_GET_KV_TREE, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput>( + this, METHODID_GET_KV_TREE))) + .addMethod( + METHOD_ALERT, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty>( + this, METHODID_ALERT))) + .addMethod( + METHOD_ALERT_RESOLVE, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty>( + this, METHODID_ALERT_RESOLVE))) + .addMethod( + METHOD_LOCK_ON_SESSION, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput>( + this, METHODID_LOCK_ON_SESSION))) + .addMethod( + METHOD_RENEW_SESSION, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty>( + this, METHODID_RENEW_SESSION))) + .addMethod( + METHOD_UNLOCK_ON_SESSION, + asyncUnaryCall( + new MethodHandlers< + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput, + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty>( + this, METHODID_UNLOCK_ON_SESSION))) + .build(); + } + } + + /** + */ + public static final class DbleClusterStub extends io.grpc.stub.AbstractStub { + private DbleClusterStub(io.grpc.Channel channel) { + super(channel); + } + + private DbleClusterStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DbleClusterStub build(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new DbleClusterStub(channel, callOptions); + } + + /** + */ + public void putKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_PUT_KV, getCallOptions()), request, responseObserver); + } + + /** + */ + public void getKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_GET_KV, getCallOptions()), request, responseObserver); + } + + /** + */ + public void deleteKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_DELETE_KV, getCallOptions()), request, responseObserver); + } + + /** + */ + public void deleteKvTree(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_DELETE_KV_TREE, getCallOptions()), request, responseObserver); + } + + /** + */ + public void subscribeKvPrefix(com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_SUBSCRIBE_KV_PREFIX, getCallOptions()), request, responseObserver); + } + + /** + */ + public void getKvTree(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_GET_KV_TREE, getCallOptions()), request, responseObserver); + } + + /** + */ + public void alert(com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_ALERT, getCallOptions()), request, responseObserver); + } + + /** + */ + public void alertResolve(com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_ALERT_RESOLVE, getCallOptions()), request, responseObserver); + } + + /** + */ + public void lockOnSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_LOCK_ON_SESSION, getCallOptions()), request, responseObserver); + } + + /** + */ + public void renewSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_RENEW_SESSION, getCallOptions()), request, responseObserver); + } + + /** + */ + public void unlockOnSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(METHOD_UNLOCK_ON_SESSION, getCallOptions()), request, responseObserver); + } + } + + /** + */ + public static final class DbleClusterBlockingStub extends io.grpc.stub.AbstractStub { + private DbleClusterBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private DbleClusterBlockingStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DbleClusterBlockingStub build(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new DbleClusterBlockingStub(channel, callOptions); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty putKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput request) { + return blockingUnaryCall( + getChannel(), METHOD_PUT_KV, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput getKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput request) { + return blockingUnaryCall( + getChannel(), METHOD_GET_KV, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty deleteKv(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput request) { + return blockingUnaryCall( + getChannel(), METHOD_DELETE_KV, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty deleteKvTree(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput request) { + return blockingUnaryCall( + getChannel(), METHOD_DELETE_KV_TREE, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput subscribeKvPrefix(com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput request) { + return blockingUnaryCall( + getChannel(), METHOD_SUBSCRIBE_KV_PREFIX, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput getKvTree(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput request) { + return blockingUnaryCall( + getChannel(), METHOD_GET_KV_TREE, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty alert(com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput request) { + return blockingUnaryCall( + getChannel(), METHOD_ALERT, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty alertResolve(com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput request) { + return blockingUnaryCall( + getChannel(), METHOD_ALERT_RESOLVE, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput lockOnSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput request) { + return blockingUnaryCall( + getChannel(), METHOD_LOCK_ON_SESSION, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty renewSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput request) { + return blockingUnaryCall( + getChannel(), METHOD_RENEW_SESSION, getCallOptions(), request); + } + + /** + */ + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty unlockOnSession(com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput request) { + return blockingUnaryCall( + getChannel(), METHOD_UNLOCK_ON_SESSION, getCallOptions(), request); + } + } + + /** + */ + public static final class DbleClusterFutureStub extends io.grpc.stub.AbstractStub { + private DbleClusterFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private DbleClusterFutureStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DbleClusterFutureStub build(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new DbleClusterFutureStub(channel, callOptions); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture putKv( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_PUT_KV, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getKv( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_GET_KV, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture deleteKv( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_DELETE_KV, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture deleteKvTree( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_DELETE_KV_TREE, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture subscribeKvPrefix( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_SUBSCRIBE_KV_PREFIX, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getKvTree( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_GET_KV_TREE, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture alert( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_ALERT, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture alertResolve( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_ALERT_RESOLVE, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture lockOnSession( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_LOCK_ON_SESSION, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture renewSession( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_RENEW_SESSION, getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture unlockOnSession( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput request) { + return futureUnaryCall( + getChannel().newCall(METHOD_UNLOCK_ON_SESSION, getCallOptions()), request); + } + } + + private static final int METHODID_PUT_KV = 0; + private static final int METHODID_GET_KV = 1; + private static final int METHODID_DELETE_KV = 2; + private static final int METHODID_DELETE_KV_TREE = 3; + private static final int METHODID_SUBSCRIBE_KV_PREFIX = 4; + private static final int METHODID_GET_KV_TREE = 5; + private static final int METHODID_ALERT = 6; + private static final int METHODID_ALERT_RESOLVE = 7; + private static final int METHODID_LOCK_ON_SESSION = 8; + private static final int METHODID_RENEW_SESSION = 9; + private static final int METHODID_UNLOCK_ON_SESSION = 10; + + private static final class MethodHandlers implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final DbleClusterImplBase serviceImpl; + private final int methodId; + + MethodHandlers(DbleClusterImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_PUT_KV: + serviceImpl.putKv((com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_KV: + serviceImpl.getKv((com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_KV: + serviceImpl.deleteKv((com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_KV_TREE: + serviceImpl.deleteKvTree((com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SUBSCRIBE_KV_PREFIX: + serviceImpl.subscribeKvPrefix((com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_KV_TREE: + serviceImpl.getKvTree((com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_ALERT: + serviceImpl.alert((com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_ALERT_RESOLVE: + serviceImpl.alertResolve((com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LOCK_ON_SESSION: + serviceImpl.lockOnSession((com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_RENEW_SESSION: + serviceImpl.renewSession((com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UNLOCK_ON_SESSION: + serviceImpl.unlockOnSession((com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private static final class DbleClusterDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier { + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.getDescriptor(); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (DbleClusterGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new DbleClusterDescriptorSupplier()) + .addMethod(METHOD_PUT_KV) + .addMethod(METHOD_GET_KV) + .addMethod(METHOD_DELETE_KV) + .addMethod(METHOD_DELETE_KV_TREE) + .addMethod(METHOD_SUBSCRIBE_KV_PREFIX) + .addMethod(METHOD_GET_KV_TREE) + .addMethod(METHOD_ALERT) + .addMethod(METHOD_ALERT_RESOLVE) + .addMethod(METHOD_LOCK_ON_SESSION) + .addMethod(METHOD_RENEW_SESSION) + .addMethod(METHOD_UNLOCK_ON_SESSION) + .build(); + } + } + } + return result; + } +} diff --git a/src/main/java/com/actiontech/dble/cluster/impl/ushard/UshardInterface.java b/src/main/java/com/actiontech/dble/cluster/impl/ushard/UshardInterface.java new file mode 100644 index 000000000..4c4eab4ed --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/impl/ushard/UshardInterface.java @@ -0,0 +1,10811 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: dbleCluster.proto + +package com.actiontech.dble.cluster.impl.ushard; + +public final class UshardInterface { + private UshardInterface() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface EmptyOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.Empty) + com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code ushard.Empty} + */ + public static final class Empty extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.Empty) + EmptyOrBuilder { + // Use Empty.newBuilder() to construct. + private Empty(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Empty() { + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private Empty( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_Empty_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_Empty_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.Builder.class); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty) obj; + + boolean result = true; + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.Empty} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.Empty) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.EmptyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_Empty_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_Empty_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_Empty_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty(this); + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty.getDefaultInstance()) return this; + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.Empty) + } + + // @@protoc_insertion_point(class_scope:ushard.Empty) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public Empty parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Empty(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.Empty getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface PutKvInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.PutKvInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Key = 1; + */ + java.lang.String getKey(); + /** + * string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * string Value = 2; + */ + java.lang.String getValue(); + /** + * string Value = 2; + */ + com.google.protobuf.ByteString + getValueBytes(); + } + /** + * Protobuf type {@code ushard.PutKvInput} + */ + public static final class PutKvInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.PutKvInput) + PutKvInputOrBuilder { + // Use PutKvInput.newBuilder() to construct. + private PutKvInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PutKvInput() { + key_ = ""; + value_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private PutKvInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + value_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_PutKvInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_PutKvInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALUE_FIELD_NUMBER = 2; + private volatile java.lang.Object value_; + /** + * string Value = 2; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } + } + /** + * string Value = 2; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + if (!getValueBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, value_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + if (!getValueBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, value_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput) obj; + + boolean result = true; + result = result && getKey() + .equals(other.getKey()); + result = result && getValue() + .equals(other.getValue()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.PutKvInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.PutKvInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_PutKvInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_PutKvInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + key_ = ""; + + value_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_PutKvInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput(this); + result.key_ = key_; + result.value_ = value_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + if (!other.getValue().isEmpty()) { + value_ = other.value_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + + private java.lang.Object value_ = ""; + /** + * string Value = 2; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Value = 2; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Value = 2; + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + value_ = value; + onChanged(); + return this; + } + /** + * string Value = 2; + */ + public Builder clearValue() { + + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * string Value = 2; + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + value_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.PutKvInput) + } + + // @@protoc_insertion_point(class_scope:ushard.PutKvInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public PutKvInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PutKvInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.PutKvInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface GetKvInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.GetKvInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Key = 1; + */ + java.lang.String getKey(); + /** + * string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + } + /** + * Protobuf type {@code ushard.GetKvInput} + */ + public static final class GetKvInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.GetKvInput) + GetKvInputOrBuilder { + // Use GetKvInput.newBuilder() to construct. + private GetKvInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GetKvInput() { + key_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private GetKvInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput) obj; + + boolean result = true; + result = result && getKey() + .equals(other.getKey()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.GetKvInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.GetKvInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + key_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput(this); + result.key_ = key_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.GetKvInput) + } + + // @@protoc_insertion_point(class_scope:ushard.GetKvInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public GetKvInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetKvInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface GetKvOutputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.GetKvOutput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Value = 1; + */ + java.lang.String getValue(); + /** + * string Value = 1; + */ + com.google.protobuf.ByteString + getValueBytes(); + } + /** + * Protobuf type {@code ushard.GetKvOutput} + */ + public static final class GetKvOutput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.GetKvOutput) + GetKvOutputOrBuilder { + // Use GetKvOutput.newBuilder() to construct. + private GetKvOutput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GetKvOutput() { + value_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private GetKvOutput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + value_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvOutput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvOutput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput.Builder.class); + } + + public static final int VALUE_FIELD_NUMBER = 1; + private volatile java.lang.Object value_; + /** + * string Value = 1; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } + } + /** + * string Value = 1; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getValueBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, value_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getValueBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, value_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput) obj; + + boolean result = true; + result = result && getValue() + .equals(other.getValue()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.GetKvOutput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.GetKvOutput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvOutput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvOutput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + value_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvOutput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput(this); + result.value_ = value_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput.getDefaultInstance()) return this; + if (!other.getValue().isEmpty()) { + value_ = other.value_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object value_ = ""; + /** + * string Value = 1; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Value = 1; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Value = 1; + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + value_ = value; + onChanged(); + return this; + } + /** + * string Value = 1; + */ + public Builder clearValue() { + + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * string Value = 1; + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + value_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.GetKvOutput) + } + + // @@protoc_insertion_point(class_scope:ushard.GetKvOutput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public GetKvOutput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetKvOutput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvOutput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface DeleteKvInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.DeleteKvInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Key = 1; + */ + java.lang.String getKey(); + /** + * string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + } + /** + * Protobuf type {@code ushard.DeleteKvInput} + */ + public static final class DeleteKvInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.DeleteKvInput) + DeleteKvInputOrBuilder { + // Use DeleteKvInput.newBuilder() to construct. + private DeleteKvInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private DeleteKvInput() { + key_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private DeleteKvInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput) obj; + + boolean result = true; + result = result && getKey() + .equals(other.getKey()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.DeleteKvInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.DeleteKvInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + key_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput(this); + result.key_ = key_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.DeleteKvInput) + } + + // @@protoc_insertion_point(class_scope:ushard.DeleteKvInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public DeleteKvInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteKvInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface DeleteKvTreeInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.DeleteKvTreeInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Key = 1; + */ + java.lang.String getKey(); + /** + * string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + } + /** + * Protobuf type {@code ushard.DeleteKvTreeInput} + */ + public static final class DeleteKvTreeInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.DeleteKvTreeInput) + DeleteKvTreeInputOrBuilder { + // Use DeleteKvTreeInput.newBuilder() to construct. + private DeleteKvTreeInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private DeleteKvTreeInput() { + key_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private DeleteKvTreeInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvTreeInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvTreeInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput) obj; + + boolean result = true; + result = result && getKey() + .equals(other.getKey()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.DeleteKvTreeInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.DeleteKvTreeInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvTreeInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvTreeInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + key_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_DeleteKvTreeInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput(this); + result.key_ = key_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.DeleteKvTreeInput) + } + + // @@protoc_insertion_point(class_scope:ushard.DeleteKvTreeInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public DeleteKvTreeInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteKvTreeInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.DeleteKvTreeInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface SubscribeKvPrefixInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.SubscribeKvPrefixInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string KeyPrefix = 1; + */ + java.lang.String getKeyPrefix(); + /** + * string KeyPrefix = 1; + */ + com.google.protobuf.ByteString + getKeyPrefixBytes(); + + /** + * uint64 Index = 2; + */ + long getIndex(); + + /** + * uint32 Duration = 3; + */ + int getDuration(); + } + /** + * Protobuf type {@code ushard.SubscribeKvPrefixInput} + */ + public static final class SubscribeKvPrefixInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.SubscribeKvPrefixInput) + SubscribeKvPrefixInputOrBuilder { + // Use SubscribeKvPrefixInput.newBuilder() to construct. + private SubscribeKvPrefixInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private SubscribeKvPrefixInput() { + keyPrefix_ = ""; + index_ = 0L; + duration_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private SubscribeKvPrefixInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + keyPrefix_ = s; + break; + } + case 16: { + + index_ = input.readUInt64(); + break; + } + case 24: { + + duration_ = input.readUInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput.Builder.class); + } + + public static final int KEYPREFIX_FIELD_NUMBER = 1; + private volatile java.lang.Object keyPrefix_; + /** + * string KeyPrefix = 1; + */ + public java.lang.String getKeyPrefix() { + java.lang.Object ref = keyPrefix_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyPrefix_ = s; + return s; + } + } + /** + * string KeyPrefix = 1; + */ + public com.google.protobuf.ByteString + getKeyPrefixBytes() { + java.lang.Object ref = keyPrefix_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + keyPrefix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INDEX_FIELD_NUMBER = 2; + private long index_; + /** + * uint64 Index = 2; + */ + public long getIndex() { + return index_; + } + + public static final int DURATION_FIELD_NUMBER = 3; + private int duration_; + /** + * uint32 Duration = 3; + */ + public int getDuration() { + return duration_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyPrefixBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, keyPrefix_); + } + if (index_ != 0L) { + output.writeUInt64(2, index_); + } + if (duration_ != 0) { + output.writeUInt32(3, duration_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyPrefixBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, keyPrefix_); + } + if (index_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(2, index_); + } + if (duration_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(3, duration_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput) obj; + + boolean result = true; + result = result && getKeyPrefix() + .equals(other.getKeyPrefix()); + result = result && (getIndex() + == other.getIndex()); + result = result && (getDuration() + == other.getDuration()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEYPREFIX_FIELD_NUMBER; + hash = (53 * hash) + getKeyPrefix().hashCode(); + hash = (37 * hash) + INDEX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getIndex()); + hash = (37 * hash) + DURATION_FIELD_NUMBER; + hash = (53 * hash) + getDuration(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.SubscribeKvPrefixInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.SubscribeKvPrefixInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + keyPrefix_ = ""; + + index_ = 0L; + + duration_ = 0; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput(this); + result.keyPrefix_ = keyPrefix_; + result.index_ = index_; + result.duration_ = duration_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput.getDefaultInstance()) return this; + if (!other.getKeyPrefix().isEmpty()) { + keyPrefix_ = other.keyPrefix_; + onChanged(); + } + if (other.getIndex() != 0L) { + setIndex(other.getIndex()); + } + if (other.getDuration() != 0) { + setDuration(other.getDuration()); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object keyPrefix_ = ""; + /** + * string KeyPrefix = 1; + */ + public java.lang.String getKeyPrefix() { + java.lang.Object ref = keyPrefix_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyPrefix_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string KeyPrefix = 1; + */ + public com.google.protobuf.ByteString + getKeyPrefixBytes() { + java.lang.Object ref = keyPrefix_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + keyPrefix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string KeyPrefix = 1; + */ + public Builder setKeyPrefix( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + keyPrefix_ = value; + onChanged(); + return this; + } + /** + * string KeyPrefix = 1; + */ + public Builder clearKeyPrefix() { + + keyPrefix_ = getDefaultInstance().getKeyPrefix(); + onChanged(); + return this; + } + /** + * string KeyPrefix = 1; + */ + public Builder setKeyPrefixBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + keyPrefix_ = value; + onChanged(); + return this; + } + + private long index_ ; + /** + * uint64 Index = 2; + */ + public long getIndex() { + return index_; + } + /** + * uint64 Index = 2; + */ + public Builder setIndex(long value) { + + index_ = value; + onChanged(); + return this; + } + /** + * uint64 Index = 2; + */ + public Builder clearIndex() { + + index_ = 0L; + onChanged(); + return this; + } + + private int duration_ ; + /** + * uint32 Duration = 3; + */ + public int getDuration() { + return duration_; + } + /** + * uint32 Duration = 3; + */ + public Builder setDuration(int value) { + + duration_ = value; + onChanged(); + return this; + } + /** + * uint32 Duration = 3; + */ + public Builder clearDuration() { + + duration_ = 0; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.SubscribeKvPrefixInput) + } + + // @@protoc_insertion_point(class_scope:ushard.SubscribeKvPrefixInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public SubscribeKvPrefixInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SubscribeKvPrefixInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface SubscribeKvPrefixOutputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.SubscribeKvPrefixOutput) + com.google.protobuf.MessageOrBuilder { + + /** + * uint64 Index = 1; + */ + long getIndex(); + + /** + * repeated string Keys = 2; + */ + java.util.List + getKeysList(); + /** + * repeated string Keys = 2; + */ + int getKeysCount(); + /** + * repeated string Keys = 2; + */ + java.lang.String getKeys(int index); + /** + * repeated string Keys = 2; + */ + com.google.protobuf.ByteString + getKeysBytes(int index); + + /** + * repeated string Values = 3; + */ + java.util.List + getValuesList(); + /** + * repeated string Values = 3; + */ + int getValuesCount(); + /** + * repeated string Values = 3; + */ + java.lang.String getValues(int index); + /** + * repeated string Values = 3; + */ + com.google.protobuf.ByteString + getValuesBytes(int index); + } + /** + * Protobuf type {@code ushard.SubscribeKvPrefixOutput} + */ + public static final class SubscribeKvPrefixOutput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.SubscribeKvPrefixOutput) + SubscribeKvPrefixOutputOrBuilder { + // Use SubscribeKvPrefixOutput.newBuilder() to construct. + private SubscribeKvPrefixOutput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private SubscribeKvPrefixOutput() { + index_ = 0L; + keys_ = com.google.protobuf.LazyStringArrayList.EMPTY; + values_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private SubscribeKvPrefixOutput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 8: { + + index_ = input.readUInt64(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + keys_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + keys_.add(s); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + values_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + values_.add(s); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + keys_ = keys_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + values_ = values_.getUnmodifiableView(); + } + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixOutput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixOutput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput.Builder.class); + } + + private int bitField0_; + public static final int INDEX_FIELD_NUMBER = 1; + private long index_; + /** + * uint64 Index = 1; + */ + public long getIndex() { + return index_; + } + + public static final int KEYS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList keys_; + /** + * repeated string Keys = 2; + */ + public com.google.protobuf.ProtocolStringList + getKeysList() { + return keys_; + } + /** + * repeated string Keys = 2; + */ + public int getKeysCount() { + return keys_.size(); + } + /** + * repeated string Keys = 2; + */ + public java.lang.String getKeys(int index) { + return keys_.get(index); + } + /** + * repeated string Keys = 2; + */ + public com.google.protobuf.ByteString + getKeysBytes(int index) { + return keys_.getByteString(index); + } + + public static final int VALUES_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList values_; + /** + * repeated string Values = 3; + */ + public com.google.protobuf.ProtocolStringList + getValuesList() { + return values_; + } + /** + * repeated string Values = 3; + */ + public int getValuesCount() { + return values_.size(); + } + /** + * repeated string Values = 3; + */ + public java.lang.String getValues(int index) { + return values_.get(index); + } + /** + * repeated string Values = 3; + */ + public com.google.protobuf.ByteString + getValuesBytes(int index) { + return values_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (index_ != 0L) { + output.writeUInt64(1, index_); + } + for (int i = 0; i < keys_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, keys_.getRaw(i)); + } + for (int i = 0; i < values_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, values_.getRaw(i)); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (index_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(1, index_); + } + { + int dataSize = 0; + for (int i = 0; i < keys_.size(); i++) { + dataSize += computeStringSizeNoTag(keys_.getRaw(i)); + } + size += dataSize; + size += 1 * getKeysList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < values_.size(); i++) { + dataSize += computeStringSizeNoTag(values_.getRaw(i)); + } + size += dataSize; + size += 1 * getValuesList().size(); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput) obj; + + boolean result = true; + result = result && (getIndex() + == other.getIndex()); + result = result && getKeysList() + .equals(other.getKeysList()); + result = result && getValuesList() + .equals(other.getValuesList()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + INDEX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getIndex()); + if (getKeysCount() > 0) { + hash = (37 * hash) + KEYS_FIELD_NUMBER; + hash = (53 * hash) + getKeysList().hashCode(); + } + if (getValuesCount() > 0) { + hash = (37 * hash) + VALUES_FIELD_NUMBER; + hash = (53 * hash) + getValuesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.SubscribeKvPrefixOutput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.SubscribeKvPrefixOutput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixOutput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixOutput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + index_ = 0L; + + keys_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + values_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_SubscribeKvPrefixOutput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.index_ = index_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + keys_ = keys_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.keys_ = keys_; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + values_ = values_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.values_ = values_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput.getDefaultInstance()) return this; + if (other.getIndex() != 0L) { + setIndex(other.getIndex()); + } + if (!other.keys_.isEmpty()) { + if (keys_.isEmpty()) { + keys_ = other.keys_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureKeysIsMutable(); + keys_.addAll(other.keys_); + } + onChanged(); + } + if (!other.values_.isEmpty()) { + if (values_.isEmpty()) { + values_ = other.values_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureValuesIsMutable(); + values_.addAll(other.values_); + } + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private long index_ ; + /** + * uint64 Index = 1; + */ + public long getIndex() { + return index_; + } + /** + * uint64 Index = 1; + */ + public Builder setIndex(long value) { + + index_ = value; + onChanged(); + return this; + } + /** + * uint64 Index = 1; + */ + public Builder clearIndex() { + + index_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList keys_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureKeysIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + keys_ = new com.google.protobuf.LazyStringArrayList(keys_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated string Keys = 2; + */ + public com.google.protobuf.ProtocolStringList + getKeysList() { + return keys_.getUnmodifiableView(); + } + /** + * repeated string Keys = 2; + */ + public int getKeysCount() { + return keys_.size(); + } + /** + * repeated string Keys = 2; + */ + public java.lang.String getKeys(int index) { + return keys_.get(index); + } + /** + * repeated string Keys = 2; + */ + public com.google.protobuf.ByteString + getKeysBytes(int index) { + return keys_.getByteString(index); + } + /** + * repeated string Keys = 2; + */ + public Builder setKeys( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string Keys = 2; + */ + public Builder addKeys( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.add(value); + onChanged(); + return this; + } + /** + * repeated string Keys = 2; + */ + public Builder addAllKeys( + java.lang.Iterable values) { + ensureKeysIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, keys_); + onChanged(); + return this; + } + /** + * repeated string Keys = 2; + */ + public Builder clearKeys() { + keys_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * repeated string Keys = 2; + */ + public Builder addKeysBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureKeysIsMutable(); + keys_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList values_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureValuesIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + values_ = new com.google.protobuf.LazyStringArrayList(values_); + bitField0_ |= 0x00000004; + } + } + /** + * repeated string Values = 3; + */ + public com.google.protobuf.ProtocolStringList + getValuesList() { + return values_.getUnmodifiableView(); + } + /** + * repeated string Values = 3; + */ + public int getValuesCount() { + return values_.size(); + } + /** + * repeated string Values = 3; + */ + public java.lang.String getValues(int index) { + return values_.get(index); + } + /** + * repeated string Values = 3; + */ + public com.google.protobuf.ByteString + getValuesBytes(int index) { + return values_.getByteString(index); + } + /** + * repeated string Values = 3; + */ + public Builder setValues( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureValuesIsMutable(); + values_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string Values = 3; + */ + public Builder addValues( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureValuesIsMutable(); + values_.add(value); + onChanged(); + return this; + } + /** + * repeated string Values = 3; + */ + public Builder addAllValues( + java.lang.Iterable values) { + ensureValuesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, values_); + onChanged(); + return this; + } + /** + * repeated string Values = 3; + */ + public Builder clearValues() { + values_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * repeated string Values = 3; + */ + public Builder addValuesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureValuesIsMutable(); + values_.add(value); + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.SubscribeKvPrefixOutput) + } + + // @@protoc_insertion_point(class_scope:ushard.SubscribeKvPrefixOutput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public SubscribeKvPrefixOutput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SubscribeKvPrefixOutput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.SubscribeKvPrefixOutput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface GetKvTreeInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.GetKvTreeInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Key = 1; + */ + java.lang.String getKey(); + /** + * string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + } + /** + * Protobuf type {@code ushard.GetKvTreeInput} + */ + public static final class GetKvTreeInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.GetKvTreeInput) + GetKvTreeInputOrBuilder { + // Use GetKvTreeInput.newBuilder() to construct. + private GetKvTreeInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GetKvTreeInput() { + key_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private GetKvTreeInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput) obj; + + boolean result = true; + result = result && getKey() + .equals(other.getKey()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.GetKvTreeInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.GetKvTreeInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + key_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput(this); + result.key_ = key_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.GetKvTreeInput) + } + + // @@protoc_insertion_point(class_scope:ushard.GetKvTreeInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public GetKvTreeInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetKvTreeInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface GetKvTreeOutputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.GetKvTreeOutput) + com.google.protobuf.MessageOrBuilder { + + /** + * uint64 Index = 1; + */ + long getIndex(); + + /** + * repeated string Keys = 2; + */ + java.util.List + getKeysList(); + /** + * repeated string Keys = 2; + */ + int getKeysCount(); + /** + * repeated string Keys = 2; + */ + java.lang.String getKeys(int index); + /** + * repeated string Keys = 2; + */ + com.google.protobuf.ByteString + getKeysBytes(int index); + + /** + * repeated string Values = 3; + */ + java.util.List + getValuesList(); + /** + * repeated string Values = 3; + */ + int getValuesCount(); + /** + * repeated string Values = 3; + */ + java.lang.String getValues(int index); + /** + * repeated string Values = 3; + */ + com.google.protobuf.ByteString + getValuesBytes(int index); + } + /** + * Protobuf type {@code ushard.GetKvTreeOutput} + */ + public static final class GetKvTreeOutput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.GetKvTreeOutput) + GetKvTreeOutputOrBuilder { + // Use GetKvTreeOutput.newBuilder() to construct. + private GetKvTreeOutput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GetKvTreeOutput() { + index_ = 0L; + keys_ = com.google.protobuf.LazyStringArrayList.EMPTY; + values_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private GetKvTreeOutput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 8: { + + index_ = input.readUInt64(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + keys_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + keys_.add(s); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + values_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + values_.add(s); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + keys_ = keys_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + values_ = values_.getUnmodifiableView(); + } + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeOutput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeOutput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput.Builder.class); + } + + private int bitField0_; + public static final int INDEX_FIELD_NUMBER = 1; + private long index_; + /** + * uint64 Index = 1; + */ + public long getIndex() { + return index_; + } + + public static final int KEYS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList keys_; + /** + * repeated string Keys = 2; + */ + public com.google.protobuf.ProtocolStringList + getKeysList() { + return keys_; + } + /** + * repeated string Keys = 2; + */ + public int getKeysCount() { + return keys_.size(); + } + /** + * repeated string Keys = 2; + */ + public java.lang.String getKeys(int index) { + return keys_.get(index); + } + /** + * repeated string Keys = 2; + */ + public com.google.protobuf.ByteString + getKeysBytes(int index) { + return keys_.getByteString(index); + } + + public static final int VALUES_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList values_; + /** + * repeated string Values = 3; + */ + public com.google.protobuf.ProtocolStringList + getValuesList() { + return values_; + } + /** + * repeated string Values = 3; + */ + public int getValuesCount() { + return values_.size(); + } + /** + * repeated string Values = 3; + */ + public java.lang.String getValues(int index) { + return values_.get(index); + } + /** + * repeated string Values = 3; + */ + public com.google.protobuf.ByteString + getValuesBytes(int index) { + return values_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (index_ != 0L) { + output.writeUInt64(1, index_); + } + for (int i = 0; i < keys_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, keys_.getRaw(i)); + } + for (int i = 0; i < values_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, values_.getRaw(i)); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (index_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(1, index_); + } + { + int dataSize = 0; + for (int i = 0; i < keys_.size(); i++) { + dataSize += computeStringSizeNoTag(keys_.getRaw(i)); + } + size += dataSize; + size += 1 * getKeysList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < values_.size(); i++) { + dataSize += computeStringSizeNoTag(values_.getRaw(i)); + } + size += dataSize; + size += 1 * getValuesList().size(); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput) obj; + + boolean result = true; + result = result && (getIndex() + == other.getIndex()); + result = result && getKeysList() + .equals(other.getKeysList()); + result = result && getValuesList() + .equals(other.getValuesList()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + INDEX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getIndex()); + if (getKeysCount() > 0) { + hash = (37 * hash) + KEYS_FIELD_NUMBER; + hash = (53 * hash) + getKeysList().hashCode(); + } + if (getValuesCount() > 0) { + hash = (37 * hash) + VALUES_FIELD_NUMBER; + hash = (53 * hash) + getValuesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.GetKvTreeOutput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.GetKvTreeOutput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeOutput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeOutput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + index_ = 0L; + + keys_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + values_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_GetKvTreeOutput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.index_ = index_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + keys_ = keys_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.keys_ = keys_; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + values_ = values_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.values_ = values_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput.getDefaultInstance()) return this; + if (other.getIndex() != 0L) { + setIndex(other.getIndex()); + } + if (!other.keys_.isEmpty()) { + if (keys_.isEmpty()) { + keys_ = other.keys_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureKeysIsMutable(); + keys_.addAll(other.keys_); + } + onChanged(); + } + if (!other.values_.isEmpty()) { + if (values_.isEmpty()) { + values_ = other.values_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureValuesIsMutable(); + values_.addAll(other.values_); + } + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private long index_ ; + /** + * uint64 Index = 1; + */ + public long getIndex() { + return index_; + } + /** + * uint64 Index = 1; + */ + public Builder setIndex(long value) { + + index_ = value; + onChanged(); + return this; + } + /** + * uint64 Index = 1; + */ + public Builder clearIndex() { + + index_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList keys_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureKeysIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + keys_ = new com.google.protobuf.LazyStringArrayList(keys_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated string Keys = 2; + */ + public com.google.protobuf.ProtocolStringList + getKeysList() { + return keys_.getUnmodifiableView(); + } + /** + * repeated string Keys = 2; + */ + public int getKeysCount() { + return keys_.size(); + } + /** + * repeated string Keys = 2; + */ + public java.lang.String getKeys(int index) { + return keys_.get(index); + } + /** + * repeated string Keys = 2; + */ + public com.google.protobuf.ByteString + getKeysBytes(int index) { + return keys_.getByteString(index); + } + /** + * repeated string Keys = 2; + */ + public Builder setKeys( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string Keys = 2; + */ + public Builder addKeys( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.add(value); + onChanged(); + return this; + } + /** + * repeated string Keys = 2; + */ + public Builder addAllKeys( + java.lang.Iterable values) { + ensureKeysIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, keys_); + onChanged(); + return this; + } + /** + * repeated string Keys = 2; + */ + public Builder clearKeys() { + keys_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * repeated string Keys = 2; + */ + public Builder addKeysBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureKeysIsMutable(); + keys_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList values_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureValuesIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + values_ = new com.google.protobuf.LazyStringArrayList(values_); + bitField0_ |= 0x00000004; + } + } + /** + * repeated string Values = 3; + */ + public com.google.protobuf.ProtocolStringList + getValuesList() { + return values_.getUnmodifiableView(); + } + /** + * repeated string Values = 3; + */ + public int getValuesCount() { + return values_.size(); + } + /** + * repeated string Values = 3; + */ + public java.lang.String getValues(int index) { + return values_.get(index); + } + /** + * repeated string Values = 3; + */ + public com.google.protobuf.ByteString + getValuesBytes(int index) { + return values_.getByteString(index); + } + /** + * repeated string Values = 3; + */ + public Builder setValues( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureValuesIsMutable(); + values_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string Values = 3; + */ + public Builder addValues( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureValuesIsMutable(); + values_.add(value); + onChanged(); + return this; + } + /** + * repeated string Values = 3; + */ + public Builder addAllValues( + java.lang.Iterable values) { + ensureValuesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, values_); + onChanged(); + return this; + } + /** + * repeated string Values = 3; + */ + public Builder clearValues() { + values_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * repeated string Values = 3; + */ + public Builder addValuesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureValuesIsMutable(); + values_.add(value); + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.GetKvTreeOutput) + } + + // @@protoc_insertion_point(class_scope:ushard.GetKvTreeOutput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public GetKvTreeOutput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetKvTreeOutput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.GetKvTreeOutput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface AlertInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.AlertInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Code = 1; + */ + java.lang.String getCode(); + /** + * string Code = 1; + */ + com.google.protobuf.ByteString + getCodeBytes(); + + /** + * string Level = 2; + */ + java.lang.String getLevel(); + /** + * string Level = 2; + */ + com.google.protobuf.ByteString + getLevelBytes(); + + /** + * string Desc = 3; + */ + java.lang.String getDesc(); + /** + * string Desc = 3; + */ + com.google.protobuf.ByteString + getDescBytes(); + + /** + * string SourceComponentType = 4; + */ + java.lang.String getSourceComponentType(); + /** + * string SourceComponentType = 4; + */ + com.google.protobuf.ByteString + getSourceComponentTypeBytes(); + + /** + * string SourceComponentId = 5; + */ + java.lang.String getSourceComponentId(); + /** + * string SourceComponentId = 5; + */ + com.google.protobuf.ByteString + getSourceComponentIdBytes(); + + /** + * string AlertComponentType = 6; + */ + java.lang.String getAlertComponentType(); + /** + * string AlertComponentType = 6; + */ + com.google.protobuf.ByteString + getAlertComponentTypeBytes(); + + /** + * string AlertComponentId = 7; + */ + java.lang.String getAlertComponentId(); + /** + * string AlertComponentId = 7; + */ + com.google.protobuf.ByteString + getAlertComponentIdBytes(); + + /** + * string ServerId = 8; + */ + java.lang.String getServerId(); + /** + * string ServerId = 8; + */ + com.google.protobuf.ByteString + getServerIdBytes(); + + /** + * map<string, string> Labels = 9; + */ + int getLabelsCount(); + /** + * map<string, string> Labels = 9; + */ + boolean containsLabels( + java.lang.String key); + /** + * Use {@link #getLabelsMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getLabels(); + /** + * map<string, string> Labels = 9; + */ + java.util.Map + getLabelsMap(); + /** + * map<string, string> Labels = 9; + */ + + java.lang.String getLabelsOrDefault( + java.lang.String key, + java.lang.String defaultValue); + /** + * map<string, string> Labels = 9; + */ + + java.lang.String getLabelsOrThrow( + java.lang.String key); + + /** + * map<string, string> Annotations = 10; + */ + int getAnnotationsCount(); + /** + * map<string, string> Annotations = 10; + */ + boolean containsAnnotations( + java.lang.String key); + /** + * Use {@link #getAnnotationsMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getAnnotations(); + /** + * map<string, string> Annotations = 10; + */ + java.util.Map + getAnnotationsMap(); + /** + * map<string, string> Annotations = 10; + */ + + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + java.lang.String defaultValue); + /** + * map<string, string> Annotations = 10; + */ + + java.lang.String getAnnotationsOrThrow( + java.lang.String key); + + /** + * int64 TimestampUnix = 11; + */ + long getTimestampUnix(); + + /** + * int64 ResolveTimestampUnix = 12; + */ + long getResolveTimestampUnix(); + } + /** + * Protobuf type {@code ushard.AlertInput} + */ + public static final class AlertInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.AlertInput) + AlertInputOrBuilder { + // Use AlertInput.newBuilder() to construct. + private AlertInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AlertInput() { + code_ = ""; + level_ = ""; + desc_ = ""; + sourceComponentType_ = ""; + sourceComponentId_ = ""; + alertComponentType_ = ""; + alertComponentId_ = ""; + serverId_ = ""; + timestampUnix_ = 0L; + resolveTimestampUnix_ = 0L; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private AlertInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + code_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + level_ = s; + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + desc_ = s; + break; + } + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + + sourceComponentType_ = s; + break; + } + case 42: { + java.lang.String s = input.readStringRequireUtf8(); + + sourceComponentId_ = s; + break; + } + case 50: { + java.lang.String s = input.readStringRequireUtf8(); + + alertComponentType_ = s; + break; + } + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + + alertComponentId_ = s; + break; + } + case 66: { + java.lang.String s = input.readStringRequireUtf8(); + + serverId_ = s; + break; + } + case 74: { + if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { + labels_ = com.google.protobuf.MapField.newMapField( + LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000100; + } + com.google.protobuf.MapEntry + labels__ = input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + labels_.getMutableMap().put( + labels__.getKey(), labels__.getValue()); + break; + } + case 82: { + if (!((mutable_bitField0_ & 0x00000200) == 0x00000200)) { + annotations_ = com.google.protobuf.MapField.newMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000200; + } + com.google.protobuf.MapEntry + annotations__ = input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + annotations_.getMutableMap().put( + annotations__.getKey(), annotations__.getValue()); + break; + } + case 88: { + + timestampUnix_ = input.readInt64(); + break; + } + case 96: { + + resolveTimestampUnix_ = input.readInt64(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_AlertInput_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 9: + return internalGetLabels(); + case 10: + return internalGetAnnotations(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_AlertInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.Builder.class); + } + + private int bitField0_; + public static final int CODE_FIELD_NUMBER = 1; + private volatile java.lang.Object code_; + /** + * string Code = 1; + */ + public java.lang.String getCode() { + java.lang.Object ref = code_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + code_ = s; + return s; + } + } + /** + * string Code = 1; + */ + public com.google.protobuf.ByteString + getCodeBytes() { + java.lang.Object ref = code_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + code_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LEVEL_FIELD_NUMBER = 2; + private volatile java.lang.Object level_; + /** + * string Level = 2; + */ + public java.lang.String getLevel() { + java.lang.Object ref = level_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + level_ = s; + return s; + } + } + /** + * string Level = 2; + */ + public com.google.protobuf.ByteString + getLevelBytes() { + java.lang.Object ref = level_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + level_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESC_FIELD_NUMBER = 3; + private volatile java.lang.Object desc_; + /** + * string Desc = 3; + */ + public java.lang.String getDesc() { + java.lang.Object ref = desc_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + desc_ = s; + return s; + } + } + /** + * string Desc = 3; + */ + public com.google.protobuf.ByteString + getDescBytes() { + java.lang.Object ref = desc_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + desc_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SOURCECOMPONENTTYPE_FIELD_NUMBER = 4; + private volatile java.lang.Object sourceComponentType_; + /** + * string SourceComponentType = 4; + */ + public java.lang.String getSourceComponentType() { + java.lang.Object ref = sourceComponentType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceComponentType_ = s; + return s; + } + } + /** + * string SourceComponentType = 4; + */ + public com.google.protobuf.ByteString + getSourceComponentTypeBytes() { + java.lang.Object ref = sourceComponentType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sourceComponentType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SOURCECOMPONENTID_FIELD_NUMBER = 5; + private volatile java.lang.Object sourceComponentId_; + /** + * string SourceComponentId = 5; + */ + public java.lang.String getSourceComponentId() { + java.lang.Object ref = sourceComponentId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceComponentId_ = s; + return s; + } + } + /** + * string SourceComponentId = 5; + */ + public com.google.protobuf.ByteString + getSourceComponentIdBytes() { + java.lang.Object ref = sourceComponentId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sourceComponentId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ALERTCOMPONENTTYPE_FIELD_NUMBER = 6; + private volatile java.lang.Object alertComponentType_; + /** + * string AlertComponentType = 6; + */ + public java.lang.String getAlertComponentType() { + java.lang.Object ref = alertComponentType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + alertComponentType_ = s; + return s; + } + } + /** + * string AlertComponentType = 6; + */ + public com.google.protobuf.ByteString + getAlertComponentTypeBytes() { + java.lang.Object ref = alertComponentType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + alertComponentType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ALERTCOMPONENTID_FIELD_NUMBER = 7; + private volatile java.lang.Object alertComponentId_; + /** + * string AlertComponentId = 7; + */ + public java.lang.String getAlertComponentId() { + java.lang.Object ref = alertComponentId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + alertComponentId_ = s; + return s; + } + } + /** + * string AlertComponentId = 7; + */ + public com.google.protobuf.ByteString + getAlertComponentIdBytes() { + java.lang.Object ref = alertComponentId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + alertComponentId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERVERID_FIELD_NUMBER = 8; + private volatile java.lang.Object serverId_; + /** + * string ServerId = 8; + */ + public java.lang.String getServerId() { + java.lang.Object ref = serverId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serverId_ = s; + return s; + } + } + /** + * string ServerId = 8; + */ + public com.google.protobuf.ByteString + getServerIdBytes() { + java.lang.Object ref = serverId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + serverId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LABELS_FIELD_NUMBER = 9; + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_AlertInput_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> labels_; + private com.google.protobuf.MapField + internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField( + LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * map<string, string> Labels = 9; + */ + + public boolean containsLabels( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetLabels().getMap().containsKey(key); + } + /** + * Use {@link #getLabelsMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * map<string, string> Labels = 9; + */ + + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * map<string, string> Labels = 9; + */ + + public java.lang.String getLabelsOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> Labels = 9; + */ + + public java.lang.String getLabelsOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 10; + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_AlertInput_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> annotations_; + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * map<string, string> Annotations = 10; + */ + + public boolean containsAnnotations( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetAnnotations().getMap().containsKey(key); + } + /** + * Use {@link #getAnnotationsMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * map<string, string> Annotations = 10; + */ + + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * map<string, string> Annotations = 10; + */ + + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> Annotations = 10; + */ + + public java.lang.String getAnnotationsOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int TIMESTAMPUNIX_FIELD_NUMBER = 11; + private long timestampUnix_; + /** + * int64 TimestampUnix = 11; + */ + public long getTimestampUnix() { + return timestampUnix_; + } + + public static final int RESOLVETIMESTAMPUNIX_FIELD_NUMBER = 12; + private long resolveTimestampUnix_; + /** + * int64 ResolveTimestampUnix = 12; + */ + public long getResolveTimestampUnix() { + return resolveTimestampUnix_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, code_); + } + if (!getLevelBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, level_); + } + if (!getDescBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, desc_); + } + if (!getSourceComponentTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, sourceComponentType_); + } + if (!getSourceComponentIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, sourceComponentId_); + } + if (!getAlertComponentTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, alertComponentType_); + } + if (!getAlertComponentIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, alertComponentId_); + } + if (!getServerIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, serverId_); + } + com.google.protobuf.GeneratedMessageV3 + .serializeStringMapTo( + output, + internalGetLabels(), + LabelsDefaultEntryHolder.defaultEntry, + 9); + com.google.protobuf.GeneratedMessageV3 + .serializeStringMapTo( + output, + internalGetAnnotations(), + AnnotationsDefaultEntryHolder.defaultEntry, + 10); + if (timestampUnix_ != 0L) { + output.writeInt64(11, timestampUnix_); + } + if (resolveTimestampUnix_ != 0L) { + output.writeInt64(12, resolveTimestampUnix_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, code_); + } + if (!getLevelBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, level_); + } + if (!getDescBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, desc_); + } + if (!getSourceComponentTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, sourceComponentType_); + } + if (!getSourceComponentIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, sourceComponentId_); + } + if (!getAlertComponentTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, alertComponentType_); + } + if (!getAlertComponentIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, alertComponentId_); + } + if (!getServerIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, serverId_); + } + for (java.util.Map.Entry entry + : internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry + labels__ = LabelsDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(9, labels__); + } + for (java.util.Map.Entry entry + : internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry + annotations__ = AnnotationsDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(10, annotations__); + } + if (timestampUnix_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(11, timestampUnix_); + } + if (resolveTimestampUnix_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(12, resolveTimestampUnix_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput) obj; + + boolean result = true; + result = result && getCode() + .equals(other.getCode()); + result = result && getLevel() + .equals(other.getLevel()); + result = result && getDesc() + .equals(other.getDesc()); + result = result && getSourceComponentType() + .equals(other.getSourceComponentType()); + result = result && getSourceComponentId() + .equals(other.getSourceComponentId()); + result = result && getAlertComponentType() + .equals(other.getAlertComponentType()); + result = result && getAlertComponentId() + .equals(other.getAlertComponentId()); + result = result && getServerId() + .equals(other.getServerId()); + result = result && internalGetLabels().equals( + other.internalGetLabels()); + result = result && internalGetAnnotations().equals( + other.internalGetAnnotations()); + result = result && (getTimestampUnix() + == other.getTimestampUnix()); + result = result && (getResolveTimestampUnix() + == other.getResolveTimestampUnix()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + CODE_FIELD_NUMBER; + hash = (53 * hash) + getCode().hashCode(); + hash = (37 * hash) + LEVEL_FIELD_NUMBER; + hash = (53 * hash) + getLevel().hashCode(); + hash = (37 * hash) + DESC_FIELD_NUMBER; + hash = (53 * hash) + getDesc().hashCode(); + hash = (37 * hash) + SOURCECOMPONENTTYPE_FIELD_NUMBER; + hash = (53 * hash) + getSourceComponentType().hashCode(); + hash = (37 * hash) + SOURCECOMPONENTID_FIELD_NUMBER; + hash = (53 * hash) + getSourceComponentId().hashCode(); + hash = (37 * hash) + ALERTCOMPONENTTYPE_FIELD_NUMBER; + hash = (53 * hash) + getAlertComponentType().hashCode(); + hash = (37 * hash) + ALERTCOMPONENTID_FIELD_NUMBER; + hash = (53 * hash) + getAlertComponentId().hashCode(); + hash = (37 * hash) + SERVERID_FIELD_NUMBER; + hash = (53 * hash) + getServerId().hashCode(); + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + hash = (37 * hash) + TIMESTAMPUNIX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTimestampUnix()); + hash = (37 * hash) + RESOLVETIMESTAMPUNIX_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getResolveTimestampUnix()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.AlertInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.AlertInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_AlertInput_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 9: + return internalGetLabels(); + case 10: + return internalGetAnnotations(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField( + int number) { + switch (number) { + case 9: + return internalGetMutableLabels(); + case 10: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_AlertInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + code_ = ""; + + level_ = ""; + + desc_ = ""; + + sourceComponentType_ = ""; + + sourceComponentId_ = ""; + + alertComponentType_ = ""; + + alertComponentId_ = ""; + + serverId_ = ""; + + internalGetMutableLabels().clear(); + internalGetMutableAnnotations().clear(); + timestampUnix_ = 0L; + + resolveTimestampUnix_ = 0L; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_AlertInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.code_ = code_; + result.level_ = level_; + result.desc_ = desc_; + result.sourceComponentType_ = sourceComponentType_; + result.sourceComponentId_ = sourceComponentId_; + result.alertComponentType_ = alertComponentType_; + result.alertComponentId_ = alertComponentId_; + result.serverId_ = serverId_; + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + result.timestampUnix_ = timestampUnix_; + result.resolveTimestampUnix_ = resolveTimestampUnix_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput.getDefaultInstance()) return this; + if (!other.getCode().isEmpty()) { + code_ = other.code_; + onChanged(); + } + if (!other.getLevel().isEmpty()) { + level_ = other.level_; + onChanged(); + } + if (!other.getDesc().isEmpty()) { + desc_ = other.desc_; + onChanged(); + } + if (!other.getSourceComponentType().isEmpty()) { + sourceComponentType_ = other.sourceComponentType_; + onChanged(); + } + if (!other.getSourceComponentId().isEmpty()) { + sourceComponentId_ = other.sourceComponentId_; + onChanged(); + } + if (!other.getAlertComponentType().isEmpty()) { + alertComponentType_ = other.alertComponentType_; + onChanged(); + } + if (!other.getAlertComponentId().isEmpty()) { + alertComponentId_ = other.alertComponentId_; + onChanged(); + } + if (!other.getServerId().isEmpty()) { + serverId_ = other.serverId_; + onChanged(); + } + internalGetMutableLabels().mergeFrom( + other.internalGetLabels()); + internalGetMutableAnnotations().mergeFrom( + other.internalGetAnnotations()); + if (other.getTimestampUnix() != 0L) { + setTimestampUnix(other.getTimestampUnix()); + } + if (other.getResolveTimestampUnix() != 0L) { + setResolveTimestampUnix(other.getResolveTimestampUnix()); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.lang.Object code_ = ""; + /** + * string Code = 1; + */ + public java.lang.String getCode() { + java.lang.Object ref = code_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + code_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Code = 1; + */ + public com.google.protobuf.ByteString + getCodeBytes() { + java.lang.Object ref = code_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + code_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Code = 1; + */ + public Builder setCode( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + code_ = value; + onChanged(); + return this; + } + /** + * string Code = 1; + */ + public Builder clearCode() { + + code_ = getDefaultInstance().getCode(); + onChanged(); + return this; + } + /** + * string Code = 1; + */ + public Builder setCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + code_ = value; + onChanged(); + return this; + } + + private java.lang.Object level_ = ""; + /** + * string Level = 2; + */ + public java.lang.String getLevel() { + java.lang.Object ref = level_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + level_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Level = 2; + */ + public com.google.protobuf.ByteString + getLevelBytes() { + java.lang.Object ref = level_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + level_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Level = 2; + */ + public Builder setLevel( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + level_ = value; + onChanged(); + return this; + } + /** + * string Level = 2; + */ + public Builder clearLevel() { + + level_ = getDefaultInstance().getLevel(); + onChanged(); + return this; + } + /** + * string Level = 2; + */ + public Builder setLevelBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + level_ = value; + onChanged(); + return this; + } + + private java.lang.Object desc_ = ""; + /** + * string Desc = 3; + */ + public java.lang.String getDesc() { + java.lang.Object ref = desc_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + desc_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Desc = 3; + */ + public com.google.protobuf.ByteString + getDescBytes() { + java.lang.Object ref = desc_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + desc_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Desc = 3; + */ + public Builder setDesc( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + desc_ = value; + onChanged(); + return this; + } + /** + * string Desc = 3; + */ + public Builder clearDesc() { + + desc_ = getDefaultInstance().getDesc(); + onChanged(); + return this; + } + /** + * string Desc = 3; + */ + public Builder setDescBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + desc_ = value; + onChanged(); + return this; + } + + private java.lang.Object sourceComponentType_ = ""; + /** + * string SourceComponentType = 4; + */ + public java.lang.String getSourceComponentType() { + java.lang.Object ref = sourceComponentType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceComponentType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string SourceComponentType = 4; + */ + public com.google.protobuf.ByteString + getSourceComponentTypeBytes() { + java.lang.Object ref = sourceComponentType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sourceComponentType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string SourceComponentType = 4; + */ + public Builder setSourceComponentType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sourceComponentType_ = value; + onChanged(); + return this; + } + /** + * string SourceComponentType = 4; + */ + public Builder clearSourceComponentType() { + + sourceComponentType_ = getDefaultInstance().getSourceComponentType(); + onChanged(); + return this; + } + /** + * string SourceComponentType = 4; + */ + public Builder setSourceComponentTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sourceComponentType_ = value; + onChanged(); + return this; + } + + private java.lang.Object sourceComponentId_ = ""; + /** + * string SourceComponentId = 5; + */ + public java.lang.String getSourceComponentId() { + java.lang.Object ref = sourceComponentId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceComponentId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string SourceComponentId = 5; + */ + public com.google.protobuf.ByteString + getSourceComponentIdBytes() { + java.lang.Object ref = sourceComponentId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sourceComponentId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string SourceComponentId = 5; + */ + public Builder setSourceComponentId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sourceComponentId_ = value; + onChanged(); + return this; + } + /** + * string SourceComponentId = 5; + */ + public Builder clearSourceComponentId() { + + sourceComponentId_ = getDefaultInstance().getSourceComponentId(); + onChanged(); + return this; + } + /** + * string SourceComponentId = 5; + */ + public Builder setSourceComponentIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sourceComponentId_ = value; + onChanged(); + return this; + } + + private java.lang.Object alertComponentType_ = ""; + /** + * string AlertComponentType = 6; + */ + public java.lang.String getAlertComponentType() { + java.lang.Object ref = alertComponentType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + alertComponentType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string AlertComponentType = 6; + */ + public com.google.protobuf.ByteString + getAlertComponentTypeBytes() { + java.lang.Object ref = alertComponentType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + alertComponentType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string AlertComponentType = 6; + */ + public Builder setAlertComponentType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + alertComponentType_ = value; + onChanged(); + return this; + } + /** + * string AlertComponentType = 6; + */ + public Builder clearAlertComponentType() { + + alertComponentType_ = getDefaultInstance().getAlertComponentType(); + onChanged(); + return this; + } + /** + * string AlertComponentType = 6; + */ + public Builder setAlertComponentTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + alertComponentType_ = value; + onChanged(); + return this; + } + + private java.lang.Object alertComponentId_ = ""; + /** + * string AlertComponentId = 7; + */ + public java.lang.String getAlertComponentId() { + java.lang.Object ref = alertComponentId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + alertComponentId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string AlertComponentId = 7; + */ + public com.google.protobuf.ByteString + getAlertComponentIdBytes() { + java.lang.Object ref = alertComponentId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + alertComponentId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string AlertComponentId = 7; + */ + public Builder setAlertComponentId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + alertComponentId_ = value; + onChanged(); + return this; + } + /** + * string AlertComponentId = 7; + */ + public Builder clearAlertComponentId() { + + alertComponentId_ = getDefaultInstance().getAlertComponentId(); + onChanged(); + return this; + } + /** + * string AlertComponentId = 7; + */ + public Builder setAlertComponentIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + alertComponentId_ = value; + onChanged(); + return this; + } + + private java.lang.Object serverId_ = ""; + /** + * string ServerId = 8; + */ + public java.lang.String getServerId() { + java.lang.Object ref = serverId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serverId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string ServerId = 8; + */ + public com.google.protobuf.ByteString + getServerIdBytes() { + java.lang.Object ref = serverId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + serverId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string ServerId = 8; + */ + public Builder setServerId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serverId_ = value; + onChanged(); + return this; + } + /** + * string ServerId = 8; + */ + public Builder clearServerId() { + + serverId_ = getDefaultInstance().getServerId(); + onChanged(); + return this; + } + /** + * string ServerId = 8; + */ + public Builder setServerIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serverId_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> labels_; + private com.google.protobuf.MapField + internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField( + LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged();; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField( + LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * map<string, string> Labels = 9; + */ + + public boolean containsLabels( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetLabels().getMap().containsKey(key); + } + /** + * Use {@link #getLabelsMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * map<string, string> Labels = 9; + */ + + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * map<string, string> Labels = 9; + */ + + public java.lang.String getLabelsOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> Labels = 9; + */ + + public java.lang.String getLabelsOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap() + .clear(); + return this; + } + /** + * map<string, string> Labels = 9; + */ + + public Builder removeLabels( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + internalGetMutableLabels().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * map<string, string> Labels = 9; + */ + public Builder putLabels( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new java.lang.NullPointerException(); } + if (value == null) { throw new java.lang.NullPointerException(); } + internalGetMutableLabels().getMutableMap() + .put(key, value); + return this; + } + /** + * map<string, string> Labels = 9; + */ + + public Builder putAllLabels( + java.util.Map values) { + internalGetMutableLabels().getMutableMap() + .putAll(values); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> annotations_; + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged();; + if (annotations_ == null) { + annotations_ = com.google.protobuf.MapField.newMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * map<string, string> Annotations = 10; + */ + + public boolean containsAnnotations( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetAnnotations().getMap().containsKey(key); + } + /** + * Use {@link #getAnnotationsMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * map<string, string> Annotations = 10; + */ + + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * map<string, string> Annotations = 10; + */ + + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, string> Annotations = 10; + */ + + public java.lang.String getAnnotationsOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap() + .clear(); + return this; + } + /** + * map<string, string> Annotations = 10; + */ + + public Builder removeAnnotations( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + internalGetMutableAnnotations().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * map<string, string> Annotations = 10; + */ + public Builder putAnnotations( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new java.lang.NullPointerException(); } + if (value == null) { throw new java.lang.NullPointerException(); } + internalGetMutableAnnotations().getMutableMap() + .put(key, value); + return this; + } + /** + * map<string, string> Annotations = 10; + */ + + public Builder putAllAnnotations( + java.util.Map values) { + internalGetMutableAnnotations().getMutableMap() + .putAll(values); + return this; + } + + private long timestampUnix_ ; + /** + * int64 TimestampUnix = 11; + */ + public long getTimestampUnix() { + return timestampUnix_; + } + /** + * int64 TimestampUnix = 11; + */ + public Builder setTimestampUnix(long value) { + + timestampUnix_ = value; + onChanged(); + return this; + } + /** + * int64 TimestampUnix = 11; + */ + public Builder clearTimestampUnix() { + + timestampUnix_ = 0L; + onChanged(); + return this; + } + + private long resolveTimestampUnix_ ; + /** + * int64 ResolveTimestampUnix = 12; + */ + public long getResolveTimestampUnix() { + return resolveTimestampUnix_; + } + /** + * int64 ResolveTimestampUnix = 12; + */ + public Builder setResolveTimestampUnix(long value) { + + resolveTimestampUnix_ = value; + onChanged(); + return this; + } + /** + * int64 ResolveTimestampUnix = 12; + */ + public Builder clearResolveTimestampUnix() { + + resolveTimestampUnix_ = 0L; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.AlertInput) + } + + // @@protoc_insertion_point(class_scope:ushard.AlertInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public AlertInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AlertInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.AlertInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface LockOnSessionInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.LockOnSessionInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Key = 1; + */ + java.lang.String getKey(); + /** + * string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * string Value = 2; + */ + java.lang.String getValue(); + /** + * string Value = 2; + */ + com.google.protobuf.ByteString + getValueBytes(); + + /** + * uint64 TTLSeconds = 3; + */ + long getTTLSeconds(); + } + /** + * Protobuf type {@code ushard.LockOnSessionInput} + */ + public static final class LockOnSessionInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.LockOnSessionInput) + LockOnSessionInputOrBuilder { + // Use LockOnSessionInput.newBuilder() to construct. + private LockOnSessionInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private LockOnSessionInput() { + key_ = ""; + value_ = ""; + tTLSeconds_ = 0L; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private LockOnSessionInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + value_ = s; + break; + } + case 24: { + + tTLSeconds_ = input.readUInt64(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALUE_FIELD_NUMBER = 2; + private volatile java.lang.Object value_; + /** + * string Value = 2; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } + } + /** + * string Value = 2; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TTLSECONDS_FIELD_NUMBER = 3; + private long tTLSeconds_; + /** + * uint64 TTLSeconds = 3; + */ + public long getTTLSeconds() { + return tTLSeconds_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + if (!getValueBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, value_); + } + if (tTLSeconds_ != 0L) { + output.writeUInt64(3, tTLSeconds_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + if (!getValueBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, value_); + } + if (tTLSeconds_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(3, tTLSeconds_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput) obj; + + boolean result = true; + result = result && getKey() + .equals(other.getKey()); + result = result && getValue() + .equals(other.getValue()); + result = result && (getTTLSeconds() + == other.getTTLSeconds()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + hash = (37 * hash) + TTLSECONDS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTTLSeconds()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.LockOnSessionInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.LockOnSessionInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + key_ = ""; + + value_ = ""; + + tTLSeconds_ = 0L; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput(this); + result.key_ = key_; + result.value_ = value_; + result.tTLSeconds_ = tTLSeconds_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + if (!other.getValue().isEmpty()) { + value_ = other.value_; + onChanged(); + } + if (other.getTTLSeconds() != 0L) { + setTTLSeconds(other.getTTLSeconds()); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + + private java.lang.Object value_ = ""; + /** + * string Value = 2; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Value = 2; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Value = 2; + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + value_ = value; + onChanged(); + return this; + } + /** + * string Value = 2; + */ + public Builder clearValue() { + + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * string Value = 2; + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + value_ = value; + onChanged(); + return this; + } + + private long tTLSeconds_ ; + /** + * uint64 TTLSeconds = 3; + */ + public long getTTLSeconds() { + return tTLSeconds_; + } + /** + * uint64 TTLSeconds = 3; + */ + public Builder setTTLSeconds(long value) { + + tTLSeconds_ = value; + onChanged(); + return this; + } + /** + * uint64 TTLSeconds = 3; + */ + public Builder clearTTLSeconds() { + + tTLSeconds_ = 0L; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.LockOnSessionInput) + } + + // @@protoc_insertion_point(class_scope:ushard.LockOnSessionInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public LockOnSessionInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LockOnSessionInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface LockOnSessionOutputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.LockOnSessionOutput) + com.google.protobuf.MessageOrBuilder { + + /** + * bool Locked = 1; + */ + boolean getLocked(); + + /** + * string SessionId = 2; + */ + java.lang.String getSessionId(); + /** + * string SessionId = 2; + */ + com.google.protobuf.ByteString + getSessionIdBytes(); + } + /** + * Protobuf type {@code ushard.LockOnSessionOutput} + */ + public static final class LockOnSessionOutput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.LockOnSessionOutput) + LockOnSessionOutputOrBuilder { + // Use LockOnSessionOutput.newBuilder() to construct. + private LockOnSessionOutput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private LockOnSessionOutput() { + locked_ = false; + sessionId_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private LockOnSessionOutput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 8: { + + locked_ = input.readBool(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + sessionId_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionOutput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionOutput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput.Builder.class); + } + + public static final int LOCKED_FIELD_NUMBER = 1; + private boolean locked_; + /** + * bool Locked = 1; + */ + public boolean getLocked() { + return locked_; + } + + public static final int SESSIONID_FIELD_NUMBER = 2; + private volatile java.lang.Object sessionId_; + /** + * string SessionId = 2; + */ + public java.lang.String getSessionId() { + java.lang.Object ref = sessionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sessionId_ = s; + return s; + } + } + /** + * string SessionId = 2; + */ + public com.google.protobuf.ByteString + getSessionIdBytes() { + java.lang.Object ref = sessionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sessionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (locked_ != false) { + output.writeBool(1, locked_); + } + if (!getSessionIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, sessionId_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (locked_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, locked_); + } + if (!getSessionIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, sessionId_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput) obj; + + boolean result = true; + result = result && (getLocked() + == other.getLocked()); + result = result && getSessionId() + .equals(other.getSessionId()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LOCKED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getLocked()); + hash = (37 * hash) + SESSIONID_FIELD_NUMBER; + hash = (53 * hash) + getSessionId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.LockOnSessionOutput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.LockOnSessionOutput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionOutput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionOutput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + locked_ = false; + + sessionId_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_LockOnSessionOutput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput(this); + result.locked_ = locked_; + result.sessionId_ = sessionId_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput.getDefaultInstance()) return this; + if (other.getLocked() != false) { + setLocked(other.getLocked()); + } + if (!other.getSessionId().isEmpty()) { + sessionId_ = other.sessionId_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean locked_ ; + /** + * bool Locked = 1; + */ + public boolean getLocked() { + return locked_; + } + /** + * bool Locked = 1; + */ + public Builder setLocked(boolean value) { + + locked_ = value; + onChanged(); + return this; + } + /** + * bool Locked = 1; + */ + public Builder clearLocked() { + + locked_ = false; + onChanged(); + return this; + } + + private java.lang.Object sessionId_ = ""; + /** + * string SessionId = 2; + */ + public java.lang.String getSessionId() { + java.lang.Object ref = sessionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sessionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string SessionId = 2; + */ + public com.google.protobuf.ByteString + getSessionIdBytes() { + java.lang.Object ref = sessionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sessionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string SessionId = 2; + */ + public Builder setSessionId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sessionId_ = value; + onChanged(); + return this; + } + /** + * string SessionId = 2; + */ + public Builder clearSessionId() { + + sessionId_ = getDefaultInstance().getSessionId(); + onChanged(); + return this; + } + /** + * string SessionId = 2; + */ + public Builder setSessionIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sessionId_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.LockOnSessionOutput) + } + + // @@protoc_insertion_point(class_scope:ushard.LockOnSessionOutput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public LockOnSessionOutput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LockOnSessionOutput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.LockOnSessionOutput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface RenewSessionInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.RenewSessionInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string SessionId = 1; + */ + java.lang.String getSessionId(); + /** + * string SessionId = 1; + */ + com.google.protobuf.ByteString + getSessionIdBytes(); + } + /** + * Protobuf type {@code ushard.RenewSessionInput} + */ + public static final class RenewSessionInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.RenewSessionInput) + RenewSessionInputOrBuilder { + // Use RenewSessionInput.newBuilder() to construct. + private RenewSessionInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private RenewSessionInput() { + sessionId_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private RenewSessionInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + sessionId_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_RenewSessionInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_RenewSessionInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput.Builder.class); + } + + public static final int SESSIONID_FIELD_NUMBER = 1; + private volatile java.lang.Object sessionId_; + /** + * string SessionId = 1; + */ + public java.lang.String getSessionId() { + java.lang.Object ref = sessionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sessionId_ = s; + return s; + } + } + /** + * string SessionId = 1; + */ + public com.google.protobuf.ByteString + getSessionIdBytes() { + java.lang.Object ref = sessionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sessionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getSessionIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sessionId_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getSessionIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sessionId_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput) obj; + + boolean result = true; + result = result && getSessionId() + .equals(other.getSessionId()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SESSIONID_FIELD_NUMBER; + hash = (53 * hash) + getSessionId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.RenewSessionInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.RenewSessionInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_RenewSessionInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_RenewSessionInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + sessionId_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_RenewSessionInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput(this); + result.sessionId_ = sessionId_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput.getDefaultInstance()) return this; + if (!other.getSessionId().isEmpty()) { + sessionId_ = other.sessionId_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object sessionId_ = ""; + /** + * string SessionId = 1; + */ + public java.lang.String getSessionId() { + java.lang.Object ref = sessionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sessionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string SessionId = 1; + */ + public com.google.protobuf.ByteString + getSessionIdBytes() { + java.lang.Object ref = sessionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sessionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string SessionId = 1; + */ + public Builder setSessionId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sessionId_ = value; + onChanged(); + return this; + } + /** + * string SessionId = 1; + */ + public Builder clearSessionId() { + + sessionId_ = getDefaultInstance().getSessionId(); + onChanged(); + return this; + } + /** + * string SessionId = 1; + */ + public Builder setSessionIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sessionId_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.RenewSessionInput) + } + + // @@protoc_insertion_point(class_scope:ushard.RenewSessionInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public RenewSessionInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RenewSessionInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.RenewSessionInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface UnlockOnSessionInputOrBuilder extends + // @@protoc_insertion_point(interface_extends:ushard.UnlockOnSessionInput) + com.google.protobuf.MessageOrBuilder { + + /** + * string Key = 1; + */ + java.lang.String getKey(); + /** + * string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * string SessionId = 2; + */ + java.lang.String getSessionId(); + /** + * string SessionId = 2; + */ + com.google.protobuf.ByteString + getSessionIdBytes(); + } + /** + * Protobuf type {@code ushard.UnlockOnSessionInput} + */ + public static final class UnlockOnSessionInput extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:ushard.UnlockOnSessionInput) + UnlockOnSessionInputOrBuilder { + // Use UnlockOnSessionInput.newBuilder() to construct. + private UnlockOnSessionInput(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private UnlockOnSessionInput() { + key_ = ""; + sessionId_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private UnlockOnSessionInput( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + sessionId_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_UnlockOnSessionInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_UnlockOnSessionInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SESSIONID_FIELD_NUMBER = 2; + private volatile java.lang.Object sessionId_; + /** + * string SessionId = 2; + */ + public java.lang.String getSessionId() { + java.lang.Object ref = sessionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sessionId_ = s; + return s; + } + } + /** + * string SessionId = 2; + */ + public com.google.protobuf.ByteString + getSessionIdBytes() { + java.lang.Object ref = sessionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sessionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + if (!getSessionIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, sessionId_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + if (!getSessionIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, sessionId_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput)) { + return super.equals(obj); + } + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput other = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput) obj; + + boolean result = true; + result = result && getKey() + .equals(other.getKey()); + result = result && getSessionId() + .equals(other.getSessionId()); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (37 * hash) + SESSIONID_FIELD_NUMBER; + hash = (53 * hash) + getSessionId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ushard.UnlockOnSessionInput} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:ushard.UnlockOnSessionInput) + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_UnlockOnSessionInput_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_UnlockOnSessionInput_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput.class, com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput.Builder.class); + } + + // Construct using com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + key_ = ""; + + sessionId_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.internal_static_ushard_UnlockOnSessionInput_descriptor; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput getDefaultInstanceForType() { + return com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput.getDefaultInstance(); + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput build() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput buildPartial() { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput result = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput(this); + result.key_ = key_; + result.sessionId_ = sessionId_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput) { + return mergeFrom((com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput other) { + if (other == com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + if (!other.getSessionId().isEmpty()) { + sessionId_ = other.sessionId_; + onChanged(); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + + private java.lang.Object sessionId_ = ""; + /** + * string SessionId = 2; + */ + public java.lang.String getSessionId() { + java.lang.Object ref = sessionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sessionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string SessionId = 2; + */ + public com.google.protobuf.ByteString + getSessionIdBytes() { + java.lang.Object ref = sessionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sessionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string SessionId = 2; + */ + public Builder setSessionId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sessionId_ = value; + onChanged(); + return this; + } + /** + * string SessionId = 2; + */ + public Builder clearSessionId() { + + sessionId_ = getDefaultInstance().getSessionId(); + onChanged(); + return this; + } + /** + * string SessionId = 2; + */ + public Builder setSessionIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sessionId_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:ushard.UnlockOnSessionInput) + } + + // @@protoc_insertion_point(class_scope:ushard.UnlockOnSessionInput) + private static final com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput(); + } + + public static com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public UnlockOnSessionInput parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UnlockOnSessionInput(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.actiontech.dble.cluster.impl.ushard.UshardInterface.UnlockOnSessionInput getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_Empty_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_Empty_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_PutKvInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_PutKvInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_GetKvInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_GetKvInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_GetKvOutput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_GetKvOutput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_DeleteKvInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_DeleteKvInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_DeleteKvTreeInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_DeleteKvTreeInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_SubscribeKvPrefixInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_SubscribeKvPrefixInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_SubscribeKvPrefixOutput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_SubscribeKvPrefixOutput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_GetKvTreeInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_GetKvTreeInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_GetKvTreeOutput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_GetKvTreeOutput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_AlertInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_AlertInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_AlertInput_LabelsEntry_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_AlertInput_LabelsEntry_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_AlertInput_AnnotationsEntry_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_AlertInput_AnnotationsEntry_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_LockOnSessionInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_LockOnSessionInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_LockOnSessionOutput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_LockOnSessionOutput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_RenewSessionInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_RenewSessionInput_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ushard_UnlockOnSessionInput_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_ushard_UnlockOnSessionInput_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\021dbleCluster.proto\022\006ushard\"\007\n\005Empty\"(\n\n" + + "PutKvInput\022\013\n\003Key\030\001 \001(\t\022\r\n\005Value\030\002 \001(\t\"\031" + + "\n\nGetKvInput\022\013\n\003Key\030\001 \001(\t\"\034\n\013GetKvOutput" + + "\022\r\n\005Value\030\001 \001(\t\"\034\n\rDeleteKvInput\022\013\n\003Key\030" + + "\001 \001(\t\" \n\021DeleteKvTreeInput\022\013\n\003Key\030\001 \001(\t\"" + + "L\n\026SubscribeKvPrefixInput\022\021\n\tKeyPrefix\030\001" + + " \001(\t\022\r\n\005Index\030\002 \001(\004\022\020\n\010Duration\030\003 \001(\r\"F\n" + + "\027SubscribeKvPrefixOutput\022\r\n\005Index\030\001 \001(\004\022" + + "\014\n\004Keys\030\002 \003(\t\022\016\n\006Values\030\003 \003(\t\"\035\n\016GetKvTr" + + "eeInput\022\013\n\003Key\030\001 \001(\t\">\n\017GetKvTreeOutput\022", + "\r\n\005Index\030\001 \001(\004\022\014\n\004Keys\030\002 \003(\t\022\016\n\006Values\030\003" + + " \003(\t\"\271\003\n\nAlertInput\022\014\n\004Code\030\001 \001(\t\022\r\n\005Lev" + + "el\030\002 \001(\t\022\014\n\004Desc\030\003 \001(\t\022\033\n\023SourceComponen" + + "tType\030\004 \001(\t\022\031\n\021SourceComponentId\030\005 \001(\t\022\032" + + "\n\022AlertComponentType\030\006 \001(\t\022\030\n\020AlertCompo" + + "nentId\030\007 \001(\t\022\020\n\010ServerId\030\010 \001(\t\022.\n\006Labels" + + "\030\t \003(\0132\036.ushard.AlertInput.LabelsEntry\0228" + + "\n\013Annotations\030\n \003(\0132#.ushard.AlertInput." + + "AnnotationsEntry\022\025\n\rTimestampUnix\030\013 \001(\003\022" + + "\034\n\024ResolveTimestampUnix\030\014 \001(\003\032-\n\013LabelsE", + "ntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\0322\n\020" + + "AnnotationsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002" + + " \001(\t:\0028\001\"D\n\022LockOnSessionInput\022\013\n\003Key\030\001 " + + "\001(\t\022\r\n\005Value\030\002 \001(\t\022\022\n\nTTLSeconds\030\003 \001(\004\"8" + + "\n\023LockOnSessionOutput\022\016\n\006Locked\030\001 \001(\010\022\021\n" + + "\tSessionId\030\002 \001(\t\"&\n\021RenewSessionInput\022\021\n" + + "\tSessionId\030\001 \001(\t\"6\n\024UnlockOnSessionInput" + + "\022\013\n\003Key\030\001 \001(\t\022\021\n\tSessionId\030\002 \001(\t2\244\005\n\013Dbl" + + "eCluster\022,\n\005PutKv\022\022.ushard.PutKvInput\032\r." + + "ushard.Empty\"\000\0222\n\005GetKv\022\022.ushard.GetKvIn", + "put\032\023.ushard.GetKvOutput\"\000\0222\n\010DeleteKv\022\025" + + ".ushard.DeleteKvInput\032\r.ushard.Empty\"\000\022:" + + "\n\014DeleteKvTree\022\031.ushard.DeleteKvTreeInpu" + + "t\032\r.ushard.Empty\"\000\022V\n\021SubscribeKvPrefix\022" + + "\036.ushard.SubscribeKvPrefixInput\032\037.ushard" + + ".SubscribeKvPrefixOutput\"\000\022>\n\tGetKvTree\022" + + "\026.ushard.GetKvTreeInput\032\027.ushard.GetKvTr" + + "eeOutput\"\000\022,\n\005Alert\022\022.ushard.AlertInput\032" + + "\r.ushard.Empty\"\000\0223\n\014AlertResolve\022\022.ushar" + + "d.AlertInput\032\r.ushard.Empty\"\000\022J\n\rLockOnS", + "ession\022\032.ushard.LockOnSessionInput\032\033.ush" + + "ard.LockOnSessionOutput\"\000\022:\n\014RenewSessio" + + "n\022\031.ushard.RenewSessionInput\032\r.ushard.Em" + + "pty\"\000\022@\n\017UnlockOnSession\022\034.ushard.Unlock" + + "OnSessionInput\032\r.ushard.Empty\"\000BE\n\'com.a" + + "ctiontech.dble.cluster.impl.ushardB\017Usha" + + "rdInterfaceP\000\242\002\006ushardb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_ushard_Empty_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_ushard_Empty_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_Empty_descriptor, + new java.lang.String[] { }); + internal_static_ushard_PutKvInput_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_ushard_PutKvInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_PutKvInput_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_ushard_GetKvInput_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_ushard_GetKvInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_GetKvInput_descriptor, + new java.lang.String[] { "Key", }); + internal_static_ushard_GetKvOutput_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_ushard_GetKvOutput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_GetKvOutput_descriptor, + new java.lang.String[] { "Value", }); + internal_static_ushard_DeleteKvInput_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_ushard_DeleteKvInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_DeleteKvInput_descriptor, + new java.lang.String[] { "Key", }); + internal_static_ushard_DeleteKvTreeInput_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_ushard_DeleteKvTreeInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_DeleteKvTreeInput_descriptor, + new java.lang.String[] { "Key", }); + internal_static_ushard_SubscribeKvPrefixInput_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_ushard_SubscribeKvPrefixInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_SubscribeKvPrefixInput_descriptor, + new java.lang.String[] { "KeyPrefix", "Index", "Duration", }); + internal_static_ushard_SubscribeKvPrefixOutput_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_ushard_SubscribeKvPrefixOutput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_SubscribeKvPrefixOutput_descriptor, + new java.lang.String[] { "Index", "Keys", "Values", }); + internal_static_ushard_GetKvTreeInput_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_ushard_GetKvTreeInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_GetKvTreeInput_descriptor, + new java.lang.String[] { "Key", }); + internal_static_ushard_GetKvTreeOutput_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_ushard_GetKvTreeOutput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_GetKvTreeOutput_descriptor, + new java.lang.String[] { "Index", "Keys", "Values", }); + internal_static_ushard_AlertInput_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_ushard_AlertInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_AlertInput_descriptor, + new java.lang.String[] { "Code", "Level", "Desc", "SourceComponentType", "SourceComponentId", "AlertComponentType", "AlertComponentId", "ServerId", "Labels", "Annotations", "TimestampUnix", "ResolveTimestampUnix", }); + internal_static_ushard_AlertInput_LabelsEntry_descriptor = + internal_static_ushard_AlertInput_descriptor.getNestedTypes().get(0); + internal_static_ushard_AlertInput_LabelsEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_AlertInput_LabelsEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_ushard_AlertInput_AnnotationsEntry_descriptor = + internal_static_ushard_AlertInput_descriptor.getNestedTypes().get(1); + internal_static_ushard_AlertInput_AnnotationsEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_AlertInput_AnnotationsEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_ushard_LockOnSessionInput_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_ushard_LockOnSessionInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_LockOnSessionInput_descriptor, + new java.lang.String[] { "Key", "Value", "TTLSeconds", }); + internal_static_ushard_LockOnSessionOutput_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_ushard_LockOnSessionOutput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_LockOnSessionOutput_descriptor, + new java.lang.String[] { "Locked", "SessionId", }); + internal_static_ushard_RenewSessionInput_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_ushard_RenewSessionInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_RenewSessionInput_descriptor, + new java.lang.String[] { "SessionId", }); + internal_static_ushard_UnlockOnSessionInput_descriptor = + getDescriptor().getMessageTypes().get(14); + internal_static_ushard_UnlockOnSessionInput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_ushard_UnlockOnSessionInput_descriptor, + new java.lang.String[] { "Key", "SessionId", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/com/actiontech/dble/cluster/impl/ushard/UshardSender.java b/src/main/java/com/actiontech/dble/cluster/impl/ushard/UshardSender.java new file mode 100644 index 000000000..9f3f2c578 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/impl/ushard/UshardSender.java @@ -0,0 +1,280 @@ +package com.actiontech.dble.cluster.impl.ushard; + +import com.actiontech.dble.cluster.AbstractClusterSender; +import com.actiontech.dble.cluster.ClusterHelper; +import com.actiontech.dble.cluster.ClusterParamCfg; +import com.actiontech.dble.cluster.bean.ClusterAlertBean; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.bean.SubscribeRequest; +import com.actiontech.dble.cluster.bean.SubscribeReturnBean; +import com.google.common.base.Strings; +import io.grpc.Channel; +import io.grpc.ManagedChannelBuilder; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.LockSupport; + +import static com.actiontech.dble.cluster.ClusterController.GENERAL_GRPC_TIMEOUT; +import static com.actiontech.dble.cluster.ClusterController.GRPC_SUBTIMEOUT; + +/** + * Created by szf on 2019/3/13. + */ +public class UshardSender extends AbstractClusterSender { + + private volatile DbleClusterGrpc.DbleClusterBlockingStub stub = null; + private ConcurrentHashMap lockMap = new ConcurrentHashMap<>(); + private Properties ushardProperties; + private final String sourceComponentType = "dble"; + private String serverId = null; + private String sourceComponentId = null; + + @Override + public void initConInfo(Properties properties) { + this.ushardProperties = properties; + serverId = getValue(ClusterParamCfg.CLUSTER_CFG_SERVER_ID); + sourceComponentId = getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + Channel channel = ManagedChannelBuilder.forAddress("127.0.0.1", + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = DbleClusterGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + } + + @Override + public void initCluster(Properties properties) { + this.ushardProperties = properties; + serverId = getValue(ClusterParamCfg.CLUSTER_CFG_SERVER_ID); + sourceComponentId = getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + Channel channel = ManagedChannelBuilder.forAddress("127.0.0.1", + Integer.parseInt(getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); + stub = DbleClusterGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); + } + + @Override + public String lock(String path, String value) throws Exception { + UshardInterface.LockOnSessionInput input = UshardInterface.LockOnSessionInput.newBuilder().setKey(path).setValue(value).setTTLSeconds(30).build(); + UshardInterface.LockOnSessionOutput output; + + try { + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).lockOnSession(input); + if (!"".equals(output.getSessionId())) { + final String session = output.getSessionId(); + Thread renewThread = new Thread(new Runnable() { + @Override + public void run() { + String sessionId = session; + while (!Thread.currentThread().isInterrupted()) { + try { + LOGGER.debug("renew lock of session start:" + sessionId + " " + path); + if ("".equals(ClusterHelper.getKV(path).getValue())) { + LOGGER.warn("renew lock of session failure:" + sessionId + " " + path + ", the key is missing "); + // alert + Thread.currentThread().interrupt(); + } else if (!renewLock(sessionId)) { + LOGGER.warn("renew lock of session failure:" + sessionId + " " + path); + // alert + } else { + LOGGER.debug("renew lock of session success:" + sessionId + " " + path); + } + LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10000)); + } catch (Exception e) { + LOGGER.warn("renew lock of session failure:" + sessionId + " " + path, e); + LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(5000)); + } + } + } + }); + lockMap.put(path, renewThread); + renewThread.setName("UCORE_RENEW_" + path); + renewThread.start(); + } + return output.getSessionId(); + } catch (Exception e1) { + throw new IOException("ushard connect failure", e1); + } + } + + @Override + public void unlockKey(String path, String sessionId) { + UshardInterface.UnlockOnSessionInput put = UshardInterface.UnlockOnSessionInput.newBuilder().setKey(path).setSessionId(sessionId).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).unlockOnSession(put); + Thread renewThread = lockMap.get(path); + if (renewThread != null) { + renewThread.interrupt(); + } + } catch (Exception e) { + LOGGER.info(sessionId + " unlockKey " + path + " error ," + stub, e); + } + } + + @Override + public void setKV(String path, String value) throws Exception { + UshardInterface.PutKvInput input = UshardInterface.PutKvInput.newBuilder().setKey(path).setValue(value).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).putKv(input); + } catch (Exception e1) { + throw new IOException("ALL the ucore connect failure"); + } + } + + @Override + public KvBean getKV(String path) { + UshardInterface.GetKvInput input = UshardInterface.GetKvInput.newBuilder().setKey(path).build(); + UshardInterface.GetKvOutput output = null; + + try { + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKv(input); + } catch (Exception e1) { + throw new RuntimeException("ALL the ucore connect failure"); + } + + KvBean bean = new KvBean(path, output.getValue(), 0); + return bean; + } + + @Override + public List getKVPath(String path) { + if (!(path.charAt(path.length() - 1) == '/')) { + path = path + "/"; + } + List result = new ArrayList(); + UshardInterface.GetKvTreeInput input = UshardInterface.GetKvTreeInput.newBuilder().setKey(path).build(); + + UshardInterface.GetKvTreeOutput output = null; + + try { + output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKvTree(input); + } catch (Exception e1) { + if (output == null) { + throw new RuntimeException("ALL the ucore connect failure"); + } + } + + for (int i = 0; i < output.getKeysCount(); i++) { + KvBean bean = new KvBean(output.getKeys(i), output.getValues(i), output.getIndex()); + result.add(bean); + } + return result; + } + + @Override + public void cleanPath(String path) { + if (!(path.charAt(path.length() - 1) == '/')) { + path = path + "/"; + } + UshardInterface.DeleteKvTreeInput input = UshardInterface.DeleteKvTreeInput.newBuilder().setKey(path).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKvTree(input); + } catch (Exception e1) { + throw new RuntimeException("ALL the ucore connect failure"); + } + cleanKV(path.substring(0, path.length() - 1)); + } + + @Override + public void cleanKV(String path) { + UshardInterface.DeleteKvInput input = UshardInterface.DeleteKvInput.newBuilder().setKey(path).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKv(input); + } catch (Exception e1) { + throw new RuntimeException("ALL the ucore connect failure"); + } + } + + @Override + public SubscribeReturnBean subscribeKvPrefix(SubscribeRequest request) throws Exception { + UshardInterface.SubscribeKvPrefixInput input = UshardInterface.SubscribeKvPrefixInput.newBuilder(). + setIndex(request.getIndex()).setDuration(request.getDuration()).setKeyPrefix(request.getPath()).build(); + try { + UshardInterface.SubscribeKvPrefixOutput output = stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeKvPrefix(input); + return groupSubscribeResult(output); + } catch (Exception e1) { + throw new IOException("ushard connect failure"); + } + + } + + @Override + public void alert(ClusterAlertBean alert) { + UshardInterface.AlertInput input = getInput(alert); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alert(input); + } catch (Exception e) { + LOGGER.info("alert to ushard error ", e); + } + } + + @Override + public boolean alertResolve(ClusterAlertBean alert) { + UshardInterface.AlertInput input = getInput(alert); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alertResolve(input); + return true; + } catch (Exception e) { + return false; + } + } + + @Override + public void checkClusterConfig(Properties properties) { + if (Strings.isNullOrEmpty(properties.getProperty(ClusterParamCfg.CLUSTER_PLUGINS_PORT.getKey())) || + Strings.isNullOrEmpty(properties.getProperty(ClusterParamCfg.CLUSTER_CFG_SERVER_ID.getKey()))) { + throw new RuntimeException("Cluster Config is not completely set"); + } + } + + public String getValue(ClusterParamCfg param) { + if (ushardProperties != null && null != param) { + return ushardProperties.getProperty(param.getKey()); + } + return null; + } + + + public boolean renewLock(String sessionId) throws Exception { + UshardInterface.RenewSessionInput input = UshardInterface.RenewSessionInput.newBuilder().setSessionId(sessionId).build(); + try { + stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).renewSession(input); + return true; + } catch (Exception e1) { + LOGGER.info("connect to ushard renew error and will retry"); + return false; + } + } + + public SubscribeReturnBean groupSubscribeResult(UshardInterface.SubscribeKvPrefixOutput output) { + SubscribeReturnBean result = new SubscribeReturnBean(); + result.setIndex(output.getIndex()); + if (output != null && output.getKeysCount() > 0) { + List kvList = new ArrayList<>(); + for (int i = 0; i < output.getKeysCount(); i++) { + kvList.add(new KvBean(output.getKeys(i), output.getValues(i), 0)); + } + result.setKvList(kvList); + } + return result; + } + + + private UshardInterface.AlertInput getInput(ClusterAlertBean alert) { + UshardInterface.AlertInput.Builder builder = UshardInterface.AlertInput.newBuilder(). + setCode(alert.getCode()). + setDesc(alert.getDesc()). + setLevel(alert.getLevel().toString()). + setSourceComponentType(sourceComponentType). + setSourceComponentId(sourceComponentId). + setAlertComponentId(alert.getAlertComponentId()). + setAlertComponentType(alert.getAlertComponentType()). + setServerId(serverId). + setTimestampUnix(System.currentTimeMillis() * 1000000); + if (alert.getLabels() != null) { + builder.putAllLabels(alert.getLabels()); + } + return builder.build(); + } +} diff --git a/src/main/java/com/actiontech/dble/cluster/impl/ushard/dbleCluster.proto b/src/main/java/com/actiontech/dble/cluster/impl/ushard/dbleCluster.proto new file mode 100644 index 000000000..cbfd41bcc --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/impl/ushard/dbleCluster.proto @@ -0,0 +1,127 @@ +syntax = "proto3"; +option java_multiple_files = false; +option java_package = "com.actiontech.dble.cluster.impl.ushard"; +option java_outer_classname = "UshardInterface"; +option objc_class_prefix = "ushard"; + +package ushard; + +service DbleCluster { + + rpc PutKv (PutKvInput) returns (Empty) { + } + + rpc GetKv (GetKvInput) returns (GetKvOutput) { + } + + rpc DeleteKv (DeleteKvInput) returns (Empty) { + } + + rpc DeleteKvTree (DeleteKvTreeInput) returns (Empty) { + } + + rpc SubscribeKvPrefix (SubscribeKvPrefixInput) returns (SubscribeKvPrefixOutput) { + } + + rpc GetKvTree (GetKvTreeInput) returns (GetKvTreeOutput) { + } + + rpc Alert (AlertInput) returns (Empty) { + } + + rpc AlertResolve (AlertInput) returns (Empty) { + } + + rpc LockOnSession (LockOnSessionInput) returns (LockOnSessionOutput) { + } + + rpc RenewSession (RenewSessionInput) returns (Empty) { + } + + rpc UnlockOnSession (UnlockOnSessionInput) returns (Empty) { + } + +} + +message Empty { +} + +message PutKvInput { + string Key = 1; + string Value = 2; +} + +message GetKvInput { + string Key = 1; +} + +message GetKvOutput { + string Value = 1; +} + +message DeleteKvInput { + string Key = 1; +} + +message DeleteKvTreeInput { + string Key = 1; +} + +message SubscribeKvPrefixInput { + string KeyPrefix = 1; + uint64 Index = 2; + uint32 Duration = 3; +} + +message SubscribeKvPrefixOutput { + uint64 Index = 1; + repeated string Keys = 2; + repeated string Values = 3; +} + +message GetKvTreeInput { + string Key = 1; +} + +message GetKvTreeOutput { + uint64 Index = 1; + repeated string Keys = 2; + repeated string Values = 3; +} + +message AlertInput { + string Code = 1; + string Level = 2; + string Desc = 3; + string SourceComponentType = 4; + string SourceComponentId = 5; + string AlertComponentType = 6; + string AlertComponentId = 7; + string ServerId = 8; + map Labels = 9; + map Annotations = 10; + int64 TimestampUnix = 11; + int64 ResolveTimestampUnix = 12; +} + + +message LockOnSessionInput { + string Key = 1; + string Value = 2; + uint64 TTLSeconds = 3; +} + + +message LockOnSessionOutput { + bool Locked = 1; + string SessionId = 2; +} + +message RenewSessionInput { + string SessionId = 1; +} + +message UnlockOnSessionInput { + string Key = 1; + string SessionId = 2; +} diff --git a/src/main/java/com/actiontech/dble/cluster/kVtoXml/ClusterToXml.java b/src/main/java/com/actiontech/dble/cluster/kVtoXml/ClusterToXml.java new file mode 100644 index 000000000..7494f5d3d --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/kVtoXml/ClusterToXml.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2016-2019 ActionTech. + * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. + */ + +package com.actiontech.dble.cluster.kVtoXml; + +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; +import com.actiontech.dble.cluster.response.*; +import com.actiontech.dble.cluster.listener.ClusterOffLineListener; +import com.actiontech.dble.cluster.listener.ClusterSingleKeyListener; +import com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase; + +import java.util.Map; + +import static com.actiontech.dble.cluster.ClusterPathUtil.SEPARATOR; + +/** + * Created by szf on 2018/1/24. + */ +public final class ClusterToXml { + + private static ClusterClearKeyListener listener = null; + + private static ClusterSingleKeyListener ddlListener = null; + + private static ClusterSingleKeyListener viewListener = null; + + private static ClusterOffLineListener onlineListener = null; + + + private ClusterToXml() { + + } + + public static void loadKVtoFile() { + try { + //create a new listener to the ucore config change + listener = new ClusterClearKeyListener(); + XmlProcessBase xmlProcess = new XmlProcessBase(); + //add all loader into listener map list + new XmlRuleLoader(xmlProcess, listener); + new XmlSchemaLoader(xmlProcess, listener); + new XmlServerLoader(xmlProcess, listener); + new XmlEhcachesLoader(xmlProcess, listener); + new CacheserviceResponse(listener); + new PropertySequenceLoader(listener); + xmlProcess.initJaxbClass(); + + //add listener to watch the Prefix of the keys + new ConfigStatusResponse(listener); + new BinlogPauseStatusResponse(listener); + new PauseDataNodeResponse(listener); + + + ddlListener = new ClusterSingleKeyListener(ClusterPathUtil.getDDLPath() + SEPARATOR, new DdlChildResponse()); + + viewListener = new ClusterSingleKeyListener(ClusterPathUtil.getViewChangePath() + SEPARATOR, new ViewChildResponse()); + + onlineListener = new ClusterOffLineListener(); + + + listener.initForXml(); + Thread thread = new Thread(listener); + thread.setName("UCORE_KEY_LISTENER"); + thread.start(); + + Thread thread2 = new Thread(ddlListener); + thread2.setName("DDL_UCORE_LISTENER"); + thread2.start(); + + Thread thread3 = new Thread(viewListener); + thread3.setName("VIEW_UCORE_LISTENER"); + thread3.start(); + + Thread thread4 = new Thread(onlineListener); + thread4.setName("ONLINE_UCORE_LISTENER"); + thread4.start(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static ClusterClearKeyListener getListener() { + return listener; + } + + public static Map getOnlineMap() { + return onlineListener.copyOnlineMap(); + } +} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreClearKeyListener.java b/src/main/java/com/actiontech/dble/cluster/listener/ClusterClearKeyListener.java similarity index 51% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreClearKeyListener.java rename to src/main/java/com/actiontech/dble/cluster/listener/ClusterClearKeyListener.java index 25401a00a..b258f1648 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreClearKeyListener.java +++ b/src/main/java/com/actiontech/dble/cluster/listener/ClusterClearKeyListener.java @@ -3,13 +3,14 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.listen; +package com.actiontech.dble.cluster.listener; -import com.actiontech.dble.alarm.UcoreInterface; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreXmlLoader; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; +import com.actiontech.dble.cluster.ClusterHelper; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.bean.SubscribeRequest; +import com.actiontech.dble.cluster.bean.SubscribeReturnBean; +import com.actiontech.dble.cluster.response.ClusterXmlLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,11 +23,11 @@ import java.util.concurrent.locks.LockSupport; /** * Created by szf on 2018/1/24. */ -public class UcoreClearKeyListener implements Runnable { +public class ClusterClearKeyListener implements Runnable { - private static final Logger LOGGER = LoggerFactory.getLogger(UcoreClearKeyListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ClusterClearKeyListener.class); - private Map childService = new HashMap<>(); + private Map childService = new HashMap<>(); private Map cache = new HashMap<>(); @@ -37,11 +38,13 @@ public class UcoreClearKeyListener implements Runnable { public void run() { for (; ; ) { try { - UcoreInterface.SubscribeKvPrefixInput input - = UcoreInterface.SubscribeKvPrefixInput.newBuilder().setIndex(index).setDuration(60).setKeyPrefix(UcorePathUtil.CONF_BASE_PATH).build(); - UcoreInterface.SubscribeKvPrefixOutput output = ClusterUcoreSender.subscribeKvPrefix(input); + SubscribeRequest request = new SubscribeRequest(); + request.setIndex(index); + request.setDuration(60); + request.setPath(ClusterPathUtil.CONF_BASE_PATH); + SubscribeReturnBean output = ClusterHelper.subscribeKvPrefix(request); if (output.getIndex() != index) { - Map diffMap = getDiffMapWithOrder(output); + Map diffMap = getDiffMapWithOrder(output); handle(diffMap); index = output.getIndex(); } @@ -53,28 +56,28 @@ public class UcoreClearKeyListener implements Runnable { } - private Map getDiffMapWithOrder(UcoreInterface.SubscribeKvPrefixOutput output) { - Map diffMap = new LinkedHashMap(); + private Map getDiffMapWithOrder(SubscribeReturnBean output) { + Map diffMap = new LinkedHashMap(); Map newKeyMap = new LinkedHashMap(); - UKvBean reloadKv = null; + KvBean reloadKv = null; //find out the new key & changed key for (int i = 0; i < output.getKeysCount(); i++) { newKeyMap.put(output.getKeys(i), output.getValues(i)); if (cache.get(output.getKeys(i)) != null) { if (!cache.get(output.getKeys(i)).equals(output.getValues(i))) { - if (output.getKeys(i).equalsIgnoreCase(UcorePathUtil.getConfStatusPath())) { - reloadKv = new UKvBean(output.getKeys(i), output.getValues(i), UKvBean.UPDATE); + if (output.getKeys(i).equalsIgnoreCase(ClusterPathUtil.getConfStatusPath())) { + reloadKv = new KvBean(output.getKeys(i), output.getValues(i), KvBean.UPDATE); } else { - diffMap.put(output.getKeys(i), new UKvBean(output.getKeys(i), output.getValues(i), UKvBean.UPDATE)); + diffMap.put(output.getKeys(i), new KvBean(output.getKeys(i), output.getValues(i), KvBean.UPDATE)); } } } else { - if (output.getKeys(i).equalsIgnoreCase(UcorePathUtil.getConfStatusPath())) { - reloadKv = new UKvBean(output.getKeys(i), output.getValues(i), UKvBean.ADD); + if (output.getKeys(i).equalsIgnoreCase(ClusterPathUtil.getConfStatusPath())) { + reloadKv = new KvBean(output.getKeys(i), output.getValues(i), KvBean.ADD); } else { - diffMap.put(output.getKeys(i), new UKvBean(output.getKeys(i), output.getValues(i), UKvBean.ADD)); + diffMap.put(output.getKeys(i), new KvBean(output.getKeys(i), output.getValues(i), KvBean.ADD)); } } } @@ -82,10 +85,10 @@ public class UcoreClearKeyListener implements Runnable { //find out the deleted Key for (Map.Entry entry : cache.entrySet()) { if (!newKeyMap.containsKey(entry.getKey())) { - if (entry.getKey().equalsIgnoreCase(UcorePathUtil.getConfStatusPath())) { - reloadKv = new UKvBean(entry.getKey(), entry.getValue(), UKvBean.DELETE); + if (entry.getKey().equalsIgnoreCase(ClusterPathUtil.getConfStatusPath())) { + reloadKv = new KvBean(entry.getKey(), entry.getValue(), KvBean.DELETE); } else { - diffMap.put(entry.getKey(), new UKvBean(entry.getKey(), entry.getValue(), UKvBean.DELETE)); + diffMap.put(entry.getKey(), new KvBean(entry.getKey(), entry.getValue(), KvBean.DELETE)); } } } @@ -101,13 +104,15 @@ public class UcoreClearKeyListener implements Runnable { public void initForXml() { try { - UcoreInterface.SubscribeKvPrefixInput input - = UcoreInterface.SubscribeKvPrefixInput.newBuilder().setIndex(0).setDuration(60).setKeyPrefix(UcorePathUtil.BASE_PATH).build(); - UcoreInterface.SubscribeKvPrefixOutput output = ClusterUcoreSender.subscribeKvPrefix(input); + SubscribeRequest request = new SubscribeRequest(); + request.setIndex(0); + request.setDuration(60); + request.setPath(ClusterPathUtil.BASE_PATH); + SubscribeReturnBean output = ClusterHelper.subscribeKvPrefix(request); index = output.getIndex(); - Map diffMap = new HashMap(); + Map diffMap = new HashMap(); for (int i = 0; i < output.getKeysCount(); i++) { - diffMap.put(output.getKeys(i), new UKvBean(output.getKeys(i), output.getValues(i), UKvBean.ADD)); + diffMap.put(output.getKeys(i), new KvBean(output.getKeys(i), output.getValues(i), KvBean.ADD)); cache.put(output.getKeys(i), output.getValues(i)); } handle(diffMap); @@ -122,10 +127,10 @@ public class UcoreClearKeyListener implements Runnable { * if the config version changes,write the file * or just start a new waiting */ - public void handle(Map diffMap) { + public void handle(Map diffMap) { try { - for (Map.Entry entry : diffMap.entrySet()) { - UcoreXmlLoader x = childService.get(entry.getKey()); + for (Map.Entry entry : diffMap.entrySet()) { + ClusterXmlLoader x = childService.get(entry.getKey()); if (x != null) { x.notifyProcess(entry.getValue()); } @@ -143,20 +148,20 @@ public class UcoreClearKeyListener implements Runnable { * @param loader * @param path */ - public void addChild(UcoreXmlLoader loader, String path) { + public void addChild(ClusterXmlLoader loader, String path) { this.childService.put(path, loader); } - public UcoreXmlLoader getReponse(String key) { + public ClusterXmlLoader getReponse(String key) { return this.childService.get(key); } public void initAllNode() { - for (Map.Entry service : childService.entrySet()) { + for (Map.Entry service : childService.entrySet()) { try { service.getValue().notifyCluster(); } catch (Exception e) { - LOGGER.warn(" UcoreClearKeyListener init all node error:", e); + LOGGER.warn(" ClusterClearKeyListener init all node error:", e); } } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UOffLineListener.java b/src/main/java/com/actiontech/dble/cluster/listener/ClusterOffLineListener.java similarity index 67% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UOffLineListener.java rename to src/main/java/com/actiontech/dble/cluster/listener/ClusterOffLineListener.java index 37a23bc35..d3a554d59 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UOffLineListener.java +++ b/src/main/java/com/actiontech/dble/cluster/listener/ClusterOffLineListener.java @@ -3,18 +3,19 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.listen; +package com.actiontech.dble.cluster.listener; import com.actiontech.dble.DbleServer; -import com.actiontech.dble.alarm.UcoreInterface; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.KVtoXml.UcoreToXml; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreXmlLoader; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.loader.UDdlChildResponse; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.bean.SubscribeRequest; +import com.actiontech.dble.cluster.bean.SubscribeReturnBean; +import com.actiontech.dble.cluster.kVtoXml.ClusterToXml; +import com.actiontech.dble.cluster.response.ClusterXmlLoader; +import com.actiontech.dble.cluster.response.DdlChildResponse; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.BinlogPause; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.PauseInfo; import com.actiontech.dble.server.status.OnlineLockStatus; @@ -24,14 +25,14 @@ import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; -import static com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil.SEPARATOR; +import static com.actiontech.dble.cluster.ClusterPathUtil.SEPARATOR; /** * Created by szf on 2018/2/8. */ -public class UOffLineListener implements Runnable { +public class ClusterOffLineListener implements Runnable { - private static final Logger LOGGER = LoggerFactory.getLogger(UOffLineListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ClusterOffLineListener.class); private volatile Map onlineMap = new HashMap<>(); private long index = 0; @@ -43,11 +44,11 @@ public class UOffLineListener implements Runnable { private void checkDDLAndRelease(String serverId) { //deal with the status when the ddl is init notified //and than the ddl server is shutdown - for (Map.Entry en : UDdlChildResponse.getLockMap().entrySet()) { + for (Map.Entry en : DdlChildResponse.getLockMap().entrySet()) { if (serverId.equals(en.getValue())) { DbleServer.getInstance().getTmManager().removeMetaLock(en.getKey().split("\\.")[0], en.getKey().split("\\.")[1]); - UDdlChildResponse.getLockMap().remove(en.getKey()); - ClusterUcoreSender.deleteKVTree(UcorePathUtil.getDDLPath(en.getKey()) + "/"); + DdlChildResponse.getLockMap().remove(en.getKey()); + ClusterHelper.cleanPath(ClusterPathUtil.getDDLPath(en.getKey()) + "/"); } } } @@ -55,17 +56,17 @@ public class UOffLineListener implements Runnable { private void checkBinlogStatusRelease(String serverId) { try { //check the latest bing_log status - UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getBinlogPauseLockPath()); + KvBean lock = ClusterHelper.getKV(ClusterPathUtil.getBinlogPauseLockPath()); if ("".equals(lock.getValue()) || serverId.equals(lock.getValue())) { DbleServer.getInstance().getBackupLocked().compareAndSet(true, false); } - UKvBean status = ClusterUcoreSender.getKey(UcorePathUtil.getBinlogPauseStatus()); + KvBean status = ClusterHelper.getKV(ClusterPathUtil.getBinlogPauseStatus()); if (!"".equals(status.getValue())) { BinlogPause pauseInfo = new BinlogPause(status.getValue()); if (pauseInfo.getStatus() == BinlogPause.BinlogPauseStatus.ON && serverId.equals(pauseInfo.getFrom())) { - ClusterUcoreSender.deleteKVTree(UcorePathUtil.getBinlogPauseStatus() + "/"); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getBinlogPauseStatus(), (new BinlogPause("", BinlogPause.BinlogPauseStatus.OFF)).toString()); - ClusterUcoreSender.deleteKV(UcorePathUtil.getBinlogPauseLockPath()); + ClusterHelper.cleanPath(ClusterPathUtil.getBinlogPauseStatus() + "/"); + ClusterHelper.setKV(ClusterPathUtil.getBinlogPauseStatus(), (new BinlogPause("", BinlogPause.BinlogPauseStatus.OFF)).toString()); + ClusterHelper.cleanKV(ClusterPathUtil.getBinlogPauseLockPath()); } } } catch (Exception e) { @@ -75,7 +76,7 @@ public class UOffLineListener implements Runnable { private void checkPauseStatusRelease(String serverId) { try { - UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getPauseDataNodePath()); + KvBean lock = ClusterHelper.getKV(ClusterPathUtil.getPauseDataNodePath()); boolean needRelease = false; if (!"".equals(lock.getValue())) { PauseInfo pauseInfo = new PauseInfo(lock.getValue()); @@ -86,7 +87,7 @@ public class UOffLineListener implements Runnable { needRelease = true; } if (needRelease) { - UcoreXmlLoader loader = UcoreToXml.getListener().getReponse(UcorePathUtil.getPauseDataNodePath()); + ClusterXmlLoader loader = ClusterToXml.getListener().getReponse(ClusterPathUtil.getPauseDataNodePath()); loader.notifyCluster(); } @@ -101,11 +102,11 @@ public class UOffLineListener implements Runnable { boolean lackSelf = false; for (; ; ) { try { - UcoreInterface.SubscribeKvPrefixInput input - = UcoreInterface.SubscribeKvPrefixInput.newBuilder(). - setIndex(index).setDuration(60). - setKeyPrefix(UcorePathUtil.getOnlinePath() + SEPARATOR).build(); - UcoreInterface.SubscribeKvPrefixOutput output = ClusterUcoreSender.subscribeKvPrefix(input); + SubscribeRequest request = new SubscribeRequest(); + request.setIndex(index); + request.setDuration(60); + request.setPath(ClusterPathUtil.getOnlinePath() + SEPARATOR); + SubscribeReturnBean output = ClusterHelper.subscribeKvPrefix(request); if (output.getIndex() == index) { if (lackSelf) { lackSelf = !reInitOnlineStatus(); @@ -127,8 +128,8 @@ public class UOffLineListener implements Runnable { checkPauseStatusRelease(serverId); } } - String serverId = UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); - String selfPath = UcorePathUtil.getOnlinePath(serverId); + String serverId = ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + String selfPath = ClusterPathUtil.getOnlinePath(serverId); if (!newMap.containsKey(selfPath)) { lackSelf = !reInitOnlineStatus(); newMap.put(selfPath, serverId); diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreSingleKeyListener.java b/src/main/java/com/actiontech/dble/cluster/listener/ClusterSingleKeyListener.java similarity index 55% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreSingleKeyListener.java rename to src/main/java/com/actiontech/dble/cluster/listener/ClusterSingleKeyListener.java index 9a628ba1d..840181228 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreSingleKeyListener.java +++ b/src/main/java/com/actiontech/dble/cluster/listener/ClusterSingleKeyListener.java @@ -3,12 +3,13 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.listen; +package com.actiontech.dble.cluster.listener; -import com.actiontech.dble.alarm.UcoreInterface; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreXmlLoader; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; +import com.actiontech.dble.cluster.ClusterHelper; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.bean.SubscribeRequest; +import com.actiontech.dble.cluster.bean.SubscribeReturnBean; +import com.actiontech.dble.cluster.response.ClusterXmlLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,14 +18,15 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.LockSupport; + /** * Created by szf on 2018/2/2. */ -public class UcoreSingleKeyListener implements Runnable { +public class ClusterSingleKeyListener implements Runnable { - private static final Logger LOGGER = LoggerFactory.getLogger(UcoreSingleKeyListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ClusterSingleKeyListener.class); private long index = 0; - UcoreXmlLoader child; + ClusterXmlLoader child; String path; private Map cache = new HashMap<>(); @@ -34,11 +36,13 @@ public class UcoreSingleKeyListener implements Runnable { public void run() { for (; ; ) { try { - UcoreInterface.SubscribeKvPrefixInput input - = UcoreInterface.SubscribeKvPrefixInput.newBuilder().setIndex(index).setDuration(60).setKeyPrefix(path).build(); - UcoreInterface.SubscribeKvPrefixOutput output = ClusterUcoreSender.subscribeKvPrefix(input); + SubscribeRequest request = new SubscribeRequest(); + request.setIndex(index); + request.setDuration(60); + request.setPath(path); + SubscribeReturnBean output = ClusterHelper.subscribeKvPrefix(request); if (output.getIndex() != index) { - Map diffMap = getDiffMap(output); + Map diffMap = getDiffMap(output); handle(diffMap); index = output.getIndex(); } @@ -50,14 +54,14 @@ public class UcoreSingleKeyListener implements Runnable { } - public UcoreSingleKeyListener(String path, UcoreXmlLoader child) { + public ClusterSingleKeyListener(String path, ClusterXmlLoader child) { this.child = child; this.path = path; } - public void handle(Map diffMap) { + public void handle(Map diffMap) { try { - for (Map.Entry entry : diffMap.entrySet()) { + for (Map.Entry entry : diffMap.entrySet()) { child.notifyProcess(entry.getValue()); } } catch (Exception e) { @@ -66,8 +70,8 @@ public class UcoreSingleKeyListener implements Runnable { } - private Map getDiffMap(UcoreInterface.SubscribeKvPrefixOutput output) { - Map diffMap = new HashMap(); + private Map getDiffMap(SubscribeReturnBean output) { + Map diffMap = new HashMap(); Map newKeyMap = new HashMap(); //find out the new key & changed key @@ -75,17 +79,17 @@ public class UcoreSingleKeyListener implements Runnable { newKeyMap.put(output.getKeys(i), output.getValues(i)); if (cache.get(output.getKeys(i)) != null) { if (!cache.get(output.getKeys(i)).equals(output.getValues(i))) { - diffMap.put(output.getKeys(i), new UKvBean(output.getKeys(i), output.getValues(i), UKvBean.UPDATE)); + diffMap.put(output.getKeys(i), new KvBean(output.getKeys(i), output.getValues(i), KvBean.UPDATE)); } } else { - diffMap.put(output.getKeys(i), new UKvBean(output.getKeys(i), output.getValues(i), UKvBean.ADD)); + diffMap.put(output.getKeys(i), new KvBean(output.getKeys(i), output.getValues(i), KvBean.ADD)); } } //find out the deleted Key for (Map.Entry entry : cache.entrySet()) { if (!newKeyMap.containsKey(entry.getKey())) { - diffMap.put(entry.getKey(), new UKvBean(entry.getKey(), entry.getValue(), UKvBean.DELETE)); + diffMap.put(entry.getKey(), new KvBean(entry.getKey(), entry.getValue(), KvBean.DELETE)); } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UBinlogPauseStatusResponse.java b/src/main/java/com/actiontech/dble/cluster/response/BinlogPauseStatusResponse.java similarity index 62% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UBinlogPauseStatusResponse.java rename to src/main/java/com/actiontech/dble/cluster/response/BinlogPauseStatusResponse.java index e947f7acc..09104fed4 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UBinlogPauseStatusResponse.java +++ b/src/main/java/com/actiontech/dble/cluster/response/BinlogPauseStatusResponse.java @@ -3,16 +3,15 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; import com.actiontech.dble.DbleServer; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreXmlLoader; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.BinlogPause; import com.actiontech.dble.manager.response.ShowBinlogStatus; import org.slf4j.Logger; @@ -21,40 +20,40 @@ import org.slf4j.LoggerFactory; /** * Created by szf on 2018/1/31. */ -public class UBinlogPauseStatusResponse implements UcoreXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UBinlogPauseStatusResponse.class); +public class BinlogPauseStatusResponse implements ClusterXmlLoader { + private static final Logger LOGGER = LoggerFactory.getLogger(BinlogPauseStatusResponse.class); - private static final String CONFIG_PATH = UcorePathUtil.getBinlogPauseStatus(); + private static final String CONFIG_PATH = ClusterPathUtil.getBinlogPauseStatus(); - public UBinlogPauseStatusResponse(UcoreClearKeyListener confListener) { + public BinlogPauseStatusResponse(ClusterClearKeyListener confListener) { confListener.addChild(this, CONFIG_PATH); } @Override - public void notifyProcess(UKvBean configValue) throws Exception { + public void notifyProcess(KvBean configValue) throws Exception { //step 1 check if the block is from the server itself BinlogPause pauseInfo = new BinlogPause(configValue.getValue()); LOGGER.info("notify " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); - if (pauseInfo.getFrom().equals(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { + if (pauseInfo.getFrom().equals(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { LOGGER.info("Self Notice,Do nothing return"); return; } //step 2 if the flag is on than try to lock all the commit - if (pauseInfo.getStatus() == BinlogPause.BinlogPauseStatus.ON && !UKvBean.DELETE.equals(configValue.getChangeType())) { + if (pauseInfo.getStatus() == BinlogPause.BinlogPauseStatus.ON && !KvBean.DELETE.equals(configValue.getChangeType())) { DbleServer.getInstance().getBackupLocked().compareAndSet(false, true); LOGGER.info("start pause for binlog status"); boolean isPaused = ShowBinlogStatus.waitAllSession(); if (!isPaused) { cleanResource(); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getBinlogPauseStatusSelf(), "Error can't wait all session finished "); + ClusterHelper.setKV(ClusterPathUtil.getBinlogPauseStatusSelf(), "Error can't wait all session finished "); return; } try { - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getBinlogPauseStatusSelf(), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(ClusterPathUtil.getBinlogPauseStatusSelf(), ClusterPathUtil.SUCCESS); } catch (Exception e) { cleanResource(); LOGGER.warn("create binlogPause instance failed", e); diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UCacheserviceResponse.java b/src/main/java/com/actiontech/dble/cluster/response/CacheserviceResponse.java similarity index 60% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UCacheserviceResponse.java rename to src/main/java/com/actiontech/dble/cluster/response/CacheserviceResponse.java index 2f7bf1592..b7154e0b9 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UCacheserviceResponse.java +++ b/src/main/java/com/actiontech/dble/cluster/response/CacheserviceResponse.java @@ -3,15 +3,14 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreXmlLoader; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.comm.ConfFileRWUtils; import com.alibaba.fastjson.JSONObject; import org.slf4j.Logger; @@ -20,24 +19,24 @@ import org.slf4j.LoggerFactory; /** * Created by szf on 2018/5/16. */ -public class UCacheserviceResponse implements UcoreXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UCacheserviceResponse.class); +public class CacheserviceResponse implements ClusterXmlLoader { + private static final Logger LOGGER = LoggerFactory.getLogger(CacheserviceResponse.class); private static final String PROPERTIES_SUFFIX = ".properties"; private static final String PROPERTIES_CACHESERVER_NAME = "cacheservice"; - private static final String CONFIG_PATH = UcorePathUtil.getEhcacheProPath(); + private static final String CONFIG_PATH = ClusterPathUtil.getEhcacheProPath(); - public UCacheserviceResponse(UcoreClearKeyListener confListener) { + public CacheserviceResponse(ClusterClearKeyListener confListener) { confListener.addChild(this, CONFIG_PATH); } @Override - public void notifyProcess(UKvBean configValue) throws Exception { + public void notifyProcess(KvBean configValue) throws Exception { LOGGER.info("notify " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); - UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getConfChangeLockPath()); - if (UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { + KvBean lock = ClusterHelper.getKV(ClusterPathUtil.getConfChangeLockPath()); + if (ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { return; } if (configValue.getValue() != null && !"".equals(configValue.getValue())) { @@ -56,6 +55,6 @@ public class UCacheserviceResponse implements UcoreXmlLoader { if (cacheService != null && !"".equals(cacheService)) { jsonObject.put(PROPERTIES_CACHESERVER_NAME, cacheService); } - ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, jsonObject.toJSONString()); + ClusterHelper.setKV(CONFIG_PATH, jsonObject.toJSONString()); } } diff --git a/src/main/java/com/actiontech/dble/cluster/response/ClusterXmlLoader.java b/src/main/java/com/actiontech/dble/cluster/response/ClusterXmlLoader.java new file mode 100644 index 000000000..0c29de6d2 --- /dev/null +++ b/src/main/java/com/actiontech/dble/cluster/response/ClusterXmlLoader.java @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2016-2019 ActionTech. + * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. + */ + +package com.actiontech.dble.cluster.response; + +import com.actiontech.dble.cluster.bean.KvBean; + +/** + * Created by szf on 2018/1/26. + */ +public interface ClusterXmlLoader { + + void notifyProcess(KvBean configValue) throws Exception; + + void notifyCluster() throws Exception; +} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UConfigStatusResponse.java b/src/main/java/com/actiontech/dble/cluster/response/ConfigStatusResponse.java similarity index 73% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UConfigStatusResponse.java rename to src/main/java/com/actiontech/dble/cluster/response/ConfigStatusResponse.java index ca1c3de25..919c8c1f7 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UConfigStatusResponse.java +++ b/src/main/java/com/actiontech/dble/cluster/response/ConfigStatusResponse.java @@ -3,14 +3,16 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; import com.actiontech.dble.DbleServer; import com.actiontech.dble.btrace.provider.ClusterDelayProvider; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.*; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ConfStatus; import com.actiontech.dble.manager.response.ReloadConfig; import com.actiontech.dble.manager.response.RollbackConfig; @@ -20,32 +22,32 @@ import org.slf4j.LoggerFactory; /** * Created by szf on 2018/1/31. */ -public class UConfigStatusResponse implements UcoreXmlLoader { +public class ConfigStatusResponse implements ClusterXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UBinlogPauseStatusResponse.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BinlogPauseStatusResponse.class); - private static final String CONFIG_PATH = UcorePathUtil.getConfStatusPath(); + private static final String CONFIG_PATH = ClusterPathUtil.getConfStatusPath(); - public UConfigStatusResponse(UcoreClearKeyListener confListener) { + public ConfigStatusResponse(ClusterClearKeyListener confListener) { confListener.addChild(this, CONFIG_PATH); } @Override - public void notifyProcess(UKvBean pathValue) throws Exception { + public void notifyProcess(KvBean pathValue) throws Exception { ClusterDelayProvider.delayAfterGetNotice(); if (DbleServer.getInstance().getFrontProcessors() != null) { //step 1 check if the change is from itself LOGGER.info("notify " + pathValue.getKey() + " " + pathValue.getValue() + " " + pathValue.getChangeType()); ConfStatus status = new ConfStatus(pathValue.getValue()); - if (status.getFrom().equals(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { + if (status.getFrom().equals(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { //self node return; } //check if the reload is already be done by this node - if (!"".equals(ClusterUcoreSender.getKey(UcorePathUtil.getSelfConfStatusPath()).getValue()) || - "".equals(ClusterUcoreSender.getKey(UcorePathUtil.getConfStatusPath()).getValue())) { + if (!"".equals(ClusterHelper.getKV(ClusterPathUtil.getSelfConfStatusPath()).getValue()) || + "".equals(ClusterHelper.getKV(ClusterPathUtil.getConfStatusPath()).getValue())) { return; } @@ -58,12 +60,12 @@ public class UConfigStatusResponse implements UcoreXmlLoader { RollbackConfig.rollback(); ClusterDelayProvider.delayAfterSlaveRollback(); LOGGER.info("rollback config: sent config status success to ucore start"); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getSelfConfStatusPath(), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(ClusterPathUtil.getSelfConfStatusPath(), ClusterPathUtil.SUCCESS); LOGGER.info("rollback config: sent config status success to ucore end"); } catch (Exception e) { String errorinfo = e.getMessage() == null ? e.toString() : e.getMessage(); LOGGER.info("rollback config: sent config status failed to ucore start"); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getSelfConfStatusPath(), errorinfo); + ClusterHelper.setKV(ClusterPathUtil.getSelfConfStatusPath(), errorinfo); LOGGER.info("rollback config: sent config status failed to ucore end"); } return; @@ -81,12 +83,12 @@ public class UConfigStatusResponse implements UcoreXmlLoader { } ClusterDelayProvider.delayAfterSlaveReload(); LOGGER.info("reload config: sent config status success to ucore start"); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getSelfConfStatusPath(), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(ClusterPathUtil.getSelfConfStatusPath(), ClusterPathUtil.SUCCESS); LOGGER.info("reload config: sent config status success to ucore end"); } catch (Exception e) { String errorinfo = e.getMessage() == null ? e.toString() : e.getMessage(); LOGGER.info("reload config: sent config status failed to ucore start"); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getSelfConfStatusPath(), errorinfo); + ClusterHelper.setKV(ClusterPathUtil.getSelfConfStatusPath(), errorinfo); LOGGER.info("reload config: sent config status failed to ucore end"); } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UDdlChildResponse.java b/src/main/java/com/actiontech/dble/cluster/response/DdlChildResponse.java similarity index 74% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UDdlChildResponse.java rename to src/main/java/com/actiontech/dble/cluster/response/DdlChildResponse.java index cf284c6d4..7a98418af 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UDdlChildResponse.java +++ b/src/main/java/com/actiontech/dble/cluster/response/DdlChildResponse.java @@ -3,16 +3,15 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; import com.actiontech.dble.DbleServer; import com.actiontech.dble.btrace.provider.ClusterDelayProvider; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreXmlLoader; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.DDLInfo; import com.actiontech.dble.util.StringUtil; import org.slf4j.Logger; @@ -24,14 +23,14 @@ import java.util.concurrent.ConcurrentHashMap; /** * Created by szf on 2018/2/1. */ -public class UDdlChildResponse implements UcoreXmlLoader { +public class DdlChildResponse implements ClusterXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UDdlChildResponse.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DdlChildResponse.class); private static Map lockMap = new ConcurrentHashMap(); @Override - public void notifyProcess(UKvBean configValue) throws Exception { - if (configValue.getKey().split("/").length == UcorePathUtil.getDDLPath().split("/").length + 2) { + public void notifyProcess(KvBean configValue) throws Exception { + if (configValue.getKey().split("/").length == ClusterPathUtil.getDDLPath().split("/").length + 2) { //child change the listener is not supported //only response for the key /un.../d.../clu.../ddl/schema.table return; @@ -43,13 +42,13 @@ public class UDdlChildResponse implements UcoreXmlLoader { final String schema = StringUtil.removeBackQuote(tableInfo[0]); final String table = StringUtil.removeBackQuote(tableInfo[1]); - if (UKvBean.DELETE.equals(configValue.getChangeType()) || "".equals(configValue.getValue())) { + if (KvBean.DELETE.equals(configValue.getChangeType()) || "".equals(configValue.getValue())) { return; } DDLInfo ddlInfo = new DDLInfo(configValue.getValue()); - if (ddlInfo.getFrom().equals(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { + if (ddlInfo.getFrom().equals(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { return; //self node } @@ -65,7 +64,7 @@ public class UDdlChildResponse implements UcoreXmlLoader { throw t; } - } else if (ddlInfo.getStatus() == DDLInfo.DDLStatus.SUCCESS && !UKvBean.DELETE.equals(configValue.getChangeType()) && + } else if (ddlInfo.getStatus() == DDLInfo.DDLStatus.SUCCESS && !KvBean.DELETE.equals(configValue.getChangeType()) && lockMap.containsKey(fullName)) { LOGGER.info("ddl execute success notice"); // if the start node is done the ddl execute @@ -81,14 +80,14 @@ public class UDdlChildResponse implements UcoreXmlLoader { } ClusterDelayProvider.delayBeforeDdlResponse(); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getDDLInstancePath(fullName), UcorePathUtil.SUCCESS); - } else if (ddlInfo.getStatus() == DDLInfo.DDLStatus.FAILED && !UKvBean.DELETE.equals(configValue.getChangeType())) { + ClusterHelper.setKV(ClusterPathUtil.getDDLInstancePath(fullName), ClusterPathUtil.SUCCESS); + } else if (ddlInfo.getStatus() == DDLInfo.DDLStatus.FAILED && !KvBean.DELETE.equals(configValue.getChangeType())) { LOGGER.info("ddl execute failed notice"); //if the start node executing ddl with error,just release the lock lockMap.remove(fullName); DbleServer.getInstance().getTmManager().removeMetaLock(schema, table); ClusterDelayProvider.delayBeforeDdlResponse(); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getDDLInstancePath(fullName), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(ClusterPathUtil.getDDLInstancePath(fullName), ClusterPathUtil.SUCCESS); } } } @@ -104,6 +103,6 @@ public class UDdlChildResponse implements UcoreXmlLoader { } public static void setLockMap(Map lockMap) { - UDdlChildResponse.lockMap = lockMap; + DdlChildResponse.lockMap = lockMap; } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UPauseDataNodeResponse.java b/src/main/java/com/actiontech/dble/cluster/response/PauseDataNodeResponse.java similarity index 73% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UPauseDataNodeResponse.java rename to src/main/java/com/actiontech/dble/cluster/response/PauseDataNodeResponse.java index f477ffd25..e28f2f5f9 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UPauseDataNodeResponse.java +++ b/src/main/java/com/actiontech/dble/cluster/response/PauseDataNodeResponse.java @@ -2,17 +2,16 @@ * Copyright (C) 2016-2019 ActionTech. * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; import com.actiontech.dble.DbleServer; import com.actiontech.dble.backend.BackendConnection; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreXmlLoader; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.PauseInfo; import com.actiontech.dble.net.FrontendConnection; import com.actiontech.dble.net.NIOProcessor; @@ -30,31 +29,31 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.ReentrantLock; -import static com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean.DELETE; +import static com.actiontech.dble.cluster.bean.KvBean.DELETE; -public class UPauseDataNodeResponse implements UcoreXmlLoader { +public class PauseDataNodeResponse implements ClusterXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UPauseDataNodeResponse.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PauseDataNodeResponse.class); - private static final String CONFIG_PATH = UcorePathUtil.getPauseDataNodePath(); + private static final String CONFIG_PATH = ClusterPathUtil.getPauseDataNodePath(); private Thread waitThread; private final Lock lock = new ReentrantLock(); - public UPauseDataNodeResponse(UcoreClearKeyListener confListener) { + public PauseDataNodeResponse(ClusterClearKeyListener confListener) { confListener.addChild(this, CONFIG_PATH); - confListener.addChild(this, UcorePathUtil.getPauseResumePath()); + confListener.addChild(this, ClusterPathUtil.getPauseResumePath()); } @Override - public void notifyProcess(UKvBean configValue) throws Exception { - LOGGER.info("get key in UPauseDataNodeResponse:" + configValue.getKey() + " " + configValue.getValue()); + public void notifyProcess(KvBean configValue) throws Exception { + LOGGER.info("get key in PauseDataNodeResponse:" + configValue.getKey() + " " + configValue.getValue()); if (!DELETE.equals(configValue.getChangeType())) { - if (configValue.getKey().equals(UcorePathUtil.getPauseDataNodePath()) || UcorePathUtil.getPauseResumePath().equals(configValue.getKey())) { + if (configValue.getKey().equals(ClusterPathUtil.getPauseDataNodePath()) || ClusterPathUtil.getPauseResumePath().equals(configValue.getKey())) { final PauseInfo pauseInfo = new PauseInfo(configValue.getValue()); - if (!pauseInfo.getFrom().equals(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { + if (!pauseInfo.getFrom().equals(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { if (PauseInfo.PAUSE.equals(pauseInfo.getType())) { final String dataNodes = pauseInfo.getDataNodes(); waitThread = new Thread(new Runnable() { @@ -90,8 +89,8 @@ public class UPauseDataNodeResponse implements UcoreXmlLoader { } } if (!nextTurn) { - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getPauseResultNodePath(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), - UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + ClusterHelper.setKV(ClusterPathUtil.getPauseResultNodePath(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); break; } } finally { @@ -118,8 +117,8 @@ public class UPauseDataNodeResponse implements UcoreXmlLoader { } LOGGER.info("resume dataNodes for get notice"); DbleServer.getInstance().getMiManager().resume(); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getPauseResumePath(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), - UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + ClusterHelper.setKV(ClusterPathUtil.getPauseResumePath(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UPropertySequenceLoader.java b/src/main/java/com/actiontech/dble/cluster/response/PropertySequenceLoader.java similarity index 71% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UPropertySequenceLoader.java rename to src/main/java/com/actiontech/dble/cluster/response/PropertySequenceLoader.java index 8d470cc64..25dbca70c 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UPropertySequenceLoader.java +++ b/src/main/java/com/actiontech/dble/cluster/response/PropertySequenceLoader.java @@ -3,12 +3,14 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.*; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.comm.ConfFileRWUtils; import com.alibaba.fastjson.JSONObject; import org.slf4j.Logger; @@ -18,9 +20,9 @@ import org.slf4j.LoggerFactory; /** * Created by szf on 2018/1/29. */ -public class UPropertySequenceLoader implements UcoreXmlLoader { +public class PropertySequenceLoader implements ClusterXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UPropertySequenceLoader.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PropertySequenceLoader.class); private static final String PROPERTIES_SUFFIX = ".properties"; @@ -29,18 +31,18 @@ public class UPropertySequenceLoader implements UcoreXmlLoader { private static final String PROPERTIES_SEQUENCE_DB_CONF = "sequence_db_conf"; - private static final String CONFIG_PATH = UcorePathUtil.getSequencesPath(); + private static final String CONFIG_PATH = ClusterPathUtil.getSequencesPath(); - public UPropertySequenceLoader(UcoreClearKeyListener confListener) { + public PropertySequenceLoader(ClusterClearKeyListener confListener) { confListener.addChild(this, CONFIG_PATH); } @Override - public void notifyProcess(UKvBean configValue) throws Exception { + public void notifyProcess(KvBean configValue) throws Exception { LOGGER.info("notify " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); - UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getConfChangeLockPath()); - if (UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { + KvBean lock = ClusterHelper.getKV(ClusterPathUtil.getConfChangeLockPath()); + if (ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { return; } if (configValue.getValue() != null && !"".equals(configValue.getValue())) { @@ -68,7 +70,7 @@ public class UPropertySequenceLoader implements UcoreXmlLoader { if (sequenceDbConf != null && !"".equals(sequenceDbConf)) { jsonObject.put(PROPERTIES_SEQUENCE_DB_CONF, sequenceDbConf); } - ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, jsonObject.toJSONString()); + ClusterHelper.setKV(CONFIG_PATH, jsonObject.toJSONString()); } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UViewChildResponse.java b/src/main/java/com/actiontech/dble/cluster/response/ViewChildResponse.java similarity index 71% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UViewChildResponse.java rename to src/main/java/com/actiontech/dble/cluster/response/ViewChildResponse.java index 236eba3c4..0644b2c6e 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UViewChildResponse.java +++ b/src/main/java/com/actiontech/dble/cluster/response/ViewChildResponse.java @@ -3,14 +3,16 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; import com.actiontech.dble.DbleServer; import com.actiontech.dble.backend.mysql.view.Repository; import com.actiontech.dble.btrace.provider.ClusterDelayProvider; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.*; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; import com.actiontech.dble.meta.ViewMeta; import com.actiontech.dble.net.mysql.ErrorPacket; import org.slf4j.Logger; @@ -18,18 +20,18 @@ import org.slf4j.LoggerFactory; import java.util.Map; -import static com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil.SEPARATOR; +import static com.actiontech.dble.cluster.ClusterPathUtil.SEPARATOR; /** * Created by szf on 2018/2/5. */ -public class UViewChildResponse implements UcoreXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UViewChildResponse.class); +public class ViewChildResponse implements ClusterXmlLoader { + private static final Logger LOGGER = LoggerFactory.getLogger(ViewChildResponse.class); @Override - public void notifyProcess(UKvBean configValue) throws Exception { + public void notifyProcess(KvBean configValue) throws Exception { LOGGER.info("notify " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); - if (configValue.getKey().split("/").length != UcorePathUtil.getViewChangePath().split("/").length + 1) { + if (configValue.getKey().split("/").length != ClusterPathUtil.getViewChangePath().split("/").length + 1) { //only with the type u.../d.../clu.../view/update(delete)/schema.table return; } @@ -43,8 +45,8 @@ public class UViewChildResponse implements UcoreXmlLoader { String serverId = configValue.getValue().split(Repository.SCHEMA_VIEW_SPLIT)[0]; String optionType = configValue.getValue().split(Repository.SCHEMA_VIEW_SPLIT)[1]; - String myId = UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); - if (myId.equals(serverId) || UKvBean.DELETE.equals(configValue.getChangeType())) { + String myId = ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + if (myId.equals(serverId) || KvBean.DELETE.equals(configValue.getChangeType())) { // self node do noting return; } else { @@ -58,15 +60,15 @@ public class UViewChildResponse implements UcoreXmlLoader { DbleServer.getInstance().getTmManager().getCatalogs().get(schema).getViewMetas().remove(viewName); ClusterDelayProvider.delayBeforeReponseView(); - ClusterUcoreSender.sendDataToUcore(configValue.getKey() + SEPARATOR + myId, UcorePathUtil.SUCCESS); + ClusterHelper.setKV(configValue.getKey() + SEPARATOR + myId, ClusterPathUtil.SUCCESS); } else if (Repository.UPDATE.equals(optionType)) { LOGGER.info("update view " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); ClusterDelayProvider.delayBeforeReponseGetView(); - String stmt = ClusterUcoreSender.getKey(UcorePathUtil.getViewPath() + SEPARATOR + schema + Repository.SCHEMA_VIEW_SPLIT + viewName).getValue(); + String stmt = ClusterHelper.getKV(ClusterPathUtil.getViewPath() + SEPARATOR + schema + Repository.SCHEMA_VIEW_SPLIT + viewName).getValue(); if (DbleServer.getInstance().getTmManager().getCatalogs().get(schema).getViewMetas().get(viewName) != null && stmt.equals(DbleServer.getInstance().getTmManager().getCatalogs().get(schema).getViewMetas().get(viewName).getCreateSql())) { ClusterDelayProvider.delayBeforeReponseView(); - ClusterUcoreSender.sendDataToUcore(configValue.getKey() + SEPARATOR + myId, UcorePathUtil.SUCCESS); + ClusterHelper.setKV(configValue.getKey() + SEPARATOR + myId, ClusterPathUtil.SUCCESS); return; } ViewMeta vm = new ViewMeta(stmt, schema, DbleServer.getInstance().getTmManager()); @@ -79,15 +81,15 @@ public class UViewChildResponse implements UcoreXmlLoader { LOGGER.info("update view result == " + error); if (error != null) { ClusterDelayProvider.delayBeforeReponseView(); - ClusterUcoreSender.sendDataToUcore(configValue.getKey() + SEPARATOR + myId, new String(error.getMessage())); + ClusterHelper.setKV(configValue.getKey() + SEPARATOR + myId, new String(error.getMessage())); return; } ClusterDelayProvider.delayBeforeReponseView(); - ClusterUcoreSender.sendDataToUcore(configValue.getKey() + SEPARATOR + myId, UcorePathUtil.SUCCESS); + ClusterHelper.setKV(configValue.getKey() + SEPARATOR + myId, ClusterPathUtil.SUCCESS); } } catch (Exception e) { - ClusterUcoreSender.sendDataToUcore(configValue.getKey() + "/" + myId, e.toString()); + ClusterHelper.setKV(configValue.getKey() + "/" + myId, e.toString()); } } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlEhcachesLoader.java b/src/main/java/com/actiontech/dble/cluster/response/XmlEhcachesLoader.java similarity index 58% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlEhcachesLoader.java rename to src/main/java/com/actiontech/dble/cluster/response/XmlEhcachesLoader.java index d39f09dae..86fd503e0 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlEhcachesLoader.java +++ b/src/main/java/com/actiontech/dble/cluster/response/XmlEhcachesLoader.java @@ -3,12 +3,14 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.*; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.entity.cache.Ehcache; import com.actiontech.dble.config.loader.zkprocess.parse.ParseJsonServiceInf; import com.actiontech.dble.config.loader.zkprocess.parse.ParseXmlServiceInf; @@ -25,8 +27,8 @@ import java.io.File; /** * Created by szf on 2018/1/29. */ -public class UXmlEhcachesLoader implements UcoreXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UXmlEhcachesLoader.class); +public class XmlEhcachesLoader implements ClusterXmlLoader { + private static final Logger LOGGER = LoggerFactory.getLogger(XmlEhcachesLoader.class); private final ParseXmlServiceInf parseEcacheXMl; @@ -34,24 +36,24 @@ public class UXmlEhcachesLoader implements UcoreXmlLoader { private static final String WRITEPATH = "ehcache.xml"; - private static final String CONFIG_PATH = UcorePathUtil.getEhcacheNamePath(); + private static final String CONFIG_PATH = ClusterPathUtil.getEhcacheNamePath(); - public UXmlEhcachesLoader(XmlProcessBase xmlParseBase, UcoreClearKeyListener confListener) { + public XmlEhcachesLoader(XmlProcessBase xmlParseBase, ClusterClearKeyListener confListener) { this.parseEcacheXMl = new EhcacheParseXmlImpl(xmlParseBase); confListener.addChild(this, CONFIG_PATH); } @Override - public void notifyProcess(UKvBean configValue) throws Exception { + public void notifyProcess(KvBean configValue) throws Exception { LOGGER.info("notify " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); - UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getConfChangeLockPath()); - if (UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { + KvBean lock = ClusterHelper.getKV(ClusterPathUtil.getConfChangeLockPath()); + if (ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { return; } JSONObject jsonObj = JSONObject.parseObject(configValue.getValue()); - if (jsonObj.get(UcorePathUtil.EHCACHE) != null) { - Ehcache ehcache = parseJsonEhcacheService.parseJsonToBean(jsonObj.getJSONObject(UcorePathUtil.EHCACHE).toJSONString()); - String path = ResourceUtil.getResourcePathFromRoot(UcorePathUtil.UCORE_LOCAL_WRITE_PATH); + if (jsonObj.get(ClusterPathUtil.EHCACHE) != null) { + Ehcache ehcache = parseJsonEhcacheService.parseJsonToBean(jsonObj.getJSONObject(ClusterPathUtil.EHCACHE).toJSONString()); + String path = ResourceUtil.getResourcePathFromRoot(ClusterPathUtil.UCORE_LOCAL_WRITE_PATH); path = new File(path).getPath() + File.separator + WRITEPATH; this.parseEcacheXMl.parseToXmlWrite(ehcache, path, null); } @@ -59,9 +61,9 @@ public class UXmlEhcachesLoader implements UcoreXmlLoader { @Override public void notifyCluster() throws Exception { - Ehcache ehcache = this.parseEcacheXMl.parseXmlToBean(UcorePathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH); + Ehcache ehcache = this.parseEcacheXMl.parseXmlToBean(ClusterPathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH); JSONObject ehcacheObj = new JSONObject(); - ehcacheObj.put(UcorePathUtil.EHCACHE, ehcache); - ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, ehcacheObj.toJSONString()); + ehcacheObj.put(ClusterPathUtil.EHCACHE, ehcache); + ClusterHelper.setKV(CONFIG_PATH, ehcacheObj.toJSONString()); } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlRuleLoader.java b/src/main/java/com/actiontech/dble/cluster/response/XmlRuleLoader.java similarity index 77% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlRuleLoader.java rename to src/main/java/com/actiontech/dble/cluster/response/XmlRuleLoader.java index 68d72cfbd..3d813892a 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlRuleLoader.java +++ b/src/main/java/com/actiontech/dble/cluster/response/XmlRuleLoader.java @@ -3,15 +3,14 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreXmlLoader; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.comm.ConfFileRWUtils; import com.actiontech.dble.config.loader.zkprocess.console.ParseParamEnum; import com.actiontech.dble.config.loader.zkprocess.entity.Property; @@ -37,8 +36,8 @@ import java.util.List; /** * Created by szf on 2018/1/26. */ -public class UXmlRuleLoader implements UcoreXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UcoreXmlLoader.class); +public class XmlRuleLoader implements ClusterXmlLoader { + private static final Logger LOGGER = LoggerFactory.getLogger(ClusterXmlLoader.class); private ParseJsonServiceInf> parseJsonTableRuleService = new TableRuleJsonParse(); @@ -48,34 +47,34 @@ public class UXmlRuleLoader implements UcoreXmlLoader { private ParseXmlServiceInf parseRulesXMl; - private static final String CONFIG_PATH = UcorePathUtil.getConfRulePath(); + private static final String CONFIG_PATH = ClusterPathUtil.getConfRulePath(); - public UXmlRuleLoader(XmlProcessBase xmlParseBase, UcoreClearKeyListener confListener) { + public XmlRuleLoader(XmlProcessBase xmlParseBase, ClusterClearKeyListener confListener) { this.parseRulesXMl = new RuleParseXmlImpl(xmlParseBase); confListener.addChild(this, CONFIG_PATH); } @Override - public void notifyProcess(UKvBean configValue) throws Exception { + public void notifyProcess(KvBean configValue) throws Exception { LOGGER.info("notify " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); - UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getConfChangeLockPath()); - if (UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { + KvBean lock = ClusterHelper.getKV(ClusterPathUtil.getConfChangeLockPath()); + if (ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { return; } Rules rule = new Rules(); //the config Value in ucore is an all in one json config of the schema.xml JSONObject jsonObj = JSONObject.parseObject(configValue.getValue()); - List functions = parseJsonFunctionService.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.FUNCTION).toJSONString()); + List functions = parseJsonFunctionService.parseJsonToBean(jsonObj.getJSONArray(ClusterPathUtil.FUNCTION).toJSONString()); rule.setFunction(functions); - List tableRules = parseJsonTableRuleService.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.TABLE_RULE).toJSONString()); + List tableRules = parseJsonTableRuleService.parseJsonToBean(jsonObj.getJSONArray(ClusterPathUtil.TABLE_RULE).toJSONString()); rule.setTableRule(tableRules); - rule.setVersion(jsonObj.getString(UcorePathUtil.VERSION)); + rule.setVersion(jsonObj.getString(ClusterPathUtil.VERSION)); - String path = ResourceUtil.getResourcePathFromRoot(UcorePathUtil.UCORE_LOCAL_WRITE_PATH); + String path = ResourceUtil.getResourcePathFromRoot(ClusterPathUtil.UCORE_LOCAL_WRITE_PATH); path = new File(path).getPath() + File.separator; path += WRITEPATH; @@ -90,14 +89,14 @@ public class UXmlRuleLoader implements UcoreXmlLoader { @Override public void notifyCluster() throws Exception { - Rules rules = this.parseRulesXMl.parseXmlToBean(UcorePathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH); + Rules rules = this.parseRulesXMl.parseXmlToBean(ClusterPathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH); JSONObject rule = new JSONObject(); readMapFileAddFunction(rules.getFunction()); - rule.put(UcorePathUtil.VERSION, rules.getVersion()); - rule.put(UcorePathUtil.TABLE_RULE, rules.getTableRule()); - rule.put(UcorePathUtil.FUNCTION, rules.getFunction()); - ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, rule.toJSONString()); + rule.put(ClusterPathUtil.VERSION, rules.getVersion()); + rule.put(ClusterPathUtil.TABLE_RULE, rules.getTableRule()); + rule.put(ClusterPathUtil.FUNCTION, rules.getFunction()); + ClusterHelper.setKV(CONFIG_PATH, rule.toJSONString()); } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlSchemaLoader.java b/src/main/java/com/actiontech/dble/cluster/response/XmlSchemaLoader.java similarity index 66% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlSchemaLoader.java rename to src/main/java/com/actiontech/dble/cluster/response/XmlSchemaLoader.java index f686ce112..c8b81c68c 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlSchemaLoader.java +++ b/src/main/java/com/actiontech/dble/cluster/response/XmlSchemaLoader.java @@ -3,12 +3,14 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.*; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.entity.Schemas; import com.actiontech.dble.config.loader.zkprocess.entity.schema.datahost.DataHost; import com.actiontech.dble.config.loader.zkprocess.entity.schema.datanode.DataNode; @@ -31,9 +33,9 @@ import java.util.List; /** * Created by szf on 2018/1/26. */ -public class UXmlSchemaLoader implements UcoreXmlLoader { +public class XmlSchemaLoader implements ClusterXmlLoader { - private static final Logger LOGGER = LoggerFactory.getLogger(UXmlSchemaLoader.class); + private static final Logger LOGGER = LoggerFactory.getLogger(XmlSchemaLoader.class); private ParseJsonServiceInf> parseJsonSchema = new SchemaJsonParse(); @@ -45,36 +47,36 @@ public class UXmlSchemaLoader implements UcoreXmlLoader { private static final String WRITEPATH = "schema.xml"; - private static final String CONFIG_PATH = UcorePathUtil.getConfSchemaPath(); + private static final String CONFIG_PATH = ClusterPathUtil.getConfSchemaPath(); - public UXmlSchemaLoader(XmlProcessBase xmlParseBase, UcoreClearKeyListener confListener) { + public XmlSchemaLoader(XmlProcessBase xmlParseBase, ClusterClearKeyListener confListener) { this.parseSchemaXmlService = new SchemasParseXmlImpl(xmlParseBase); confListener.addChild(this, CONFIG_PATH); } @Override - public void notifyProcess(UKvBean configValue) throws Exception { + public void notifyProcess(KvBean configValue) throws Exception { LOGGER.info("notify " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); - UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getConfChangeLockPath()); - if (UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { + KvBean lock = ClusterHelper.getKV(ClusterPathUtil.getConfChangeLockPath()); + if (ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { return; } Schemas schema = new Schemas(); //the config Value in ucore is an all in one json config of the schema.xml JSONObject jsonObj = JSONObject.parseObject(configValue.getValue()); - List schemaList = parseJsonSchema.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.SCHEMA_SCHEMA).toJSONString()); + List schemaList = parseJsonSchema.parseJsonToBean(jsonObj.getJSONArray(ClusterPathUtil.SCHEMA_SCHEMA).toJSONString()); schema.setSchema(schemaList); - List dataNodeList = parseJsonDataNode.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.DATA_NODE).toJSONString()); + List dataNodeList = parseJsonDataNode.parseJsonToBean(jsonObj.getJSONArray(ClusterPathUtil.DATA_NODE).toJSONString()); schema.setDataNode(dataNodeList); - List dataHostList = parseJsonDataHost.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.DATA_HOST).toJSONString()); + List dataHostList = parseJsonDataHost.parseJsonToBean(jsonObj.getJSONArray(ClusterPathUtil.DATA_HOST).toJSONString()); schema.setDataHost(dataHostList); - schema.setVersion(jsonObj.getString(UcorePathUtil.VERSION)); + schema.setVersion(jsonObj.getString(ClusterPathUtil.VERSION)); - String path = ResourceUtil.getResourcePathFromRoot(UcorePathUtil.UCORE_LOCAL_WRITE_PATH); + String path = ResourceUtil.getResourcePathFromRoot(ClusterPathUtil.UCORE_LOCAL_WRITE_PATH); path = new File(path).getPath() + File.separator; path += WRITEPATH; @@ -88,13 +90,13 @@ public class UXmlSchemaLoader implements UcoreXmlLoader { @Override public void notifyCluster() throws Exception { - Schemas schema = this.parseSchemaXmlService.parseXmlToBean(UcorePathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH); + Schemas schema = this.parseSchemaXmlService.parseXmlToBean(ClusterPathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH); JSONObject schemas = new JSONObject(); - schemas.put(UcorePathUtil.VERSION, schema.getVersion()); - schemas.put(UcorePathUtil.SCHEMA_SCHEMA, schema.getSchema()); - schemas.put(UcorePathUtil.DATA_NODE, schema.getDataNode()); - schemas.put(UcorePathUtil.DATA_HOST, schema.getDataHost()); - ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, schemas.toJSONString()); + schemas.put(ClusterPathUtil.VERSION, schema.getVersion()); + schemas.put(ClusterPathUtil.SCHEMA_SCHEMA, schema.getSchema()); + schemas.put(ClusterPathUtil.DATA_NODE, schema.getDataNode()); + schemas.put(ClusterPathUtil.DATA_HOST, schema.getDataHost()); + ClusterHelper.setKV(CONFIG_PATH, schemas.toJSONString()); } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlServerLoader.java b/src/main/java/com/actiontech/dble/cluster/response/XmlServerLoader.java similarity index 60% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlServerLoader.java rename to src/main/java/com/actiontech/dble/cluster/response/XmlServerLoader.java index 7a1c5c20a..6544a989b 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/loader/UXmlServerLoader.java +++ b/src/main/java/com/actiontech/dble/cluster/response/XmlServerLoader.java @@ -3,12 +3,14 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess.loader; +package com.actiontech.dble.cluster.response; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.*; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; import com.actiontech.dble.config.loader.zkprocess.entity.Server; import com.actiontech.dble.config.loader.zkprocess.entity.server.FireWall; import com.actiontech.dble.config.loader.zkprocess.entity.server.System; @@ -31,7 +33,7 @@ import java.util.List; /** * Created by szf on 2018/1/26. */ -public class UXmlServerLoader implements UcoreXmlLoader { +public class XmlServerLoader implements ClusterXmlLoader { private ParseXmlServiceInf parseServerXMl; @@ -43,32 +45,32 @@ public class UXmlServerLoader implements UcoreXmlLoader { private static final String WRITEPATH = "server.xml"; - private static final String CONFIG_PATH = UcorePathUtil.getConfServerPath(); + private static final String CONFIG_PATH = ClusterPathUtil.getConfServerPath(); - private static final Logger LOGGER = LoggerFactory.getLogger(UXmlServerLoader.class); + private static final Logger LOGGER = LoggerFactory.getLogger(XmlServerLoader.class); - public UXmlServerLoader(XmlProcessBase xmlParseBase, UcoreClearKeyListener confListener) { + public XmlServerLoader(XmlProcessBase xmlParseBase, ClusterClearKeyListener confListener) { this.parseServerXMl = new ServerParseXmlImpl(xmlParseBase); confListener.addChild(this, CONFIG_PATH); } @Override - public void notifyProcess(UKvBean configValue) throws Exception { + public void notifyProcess(KvBean configValue) throws Exception { LOGGER.info("notify " + configValue.getKey() + " " + configValue.getValue() + " " + configValue.getChangeType()); - UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getConfChangeLockPath()); - if (UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { + KvBean lock = ClusterHelper.getKV(ClusterPathUtil.getConfChangeLockPath()); + if (ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) { return; } Server server = new Server(); JSONObject jsonObj = JSONObject.parseObject(configValue.getValue()); - if (jsonObj.get(UcorePathUtil.FIREWALL) != null) { - server.setFirewall(parseJsonFireWall.parseJsonToBean(jsonObj.getJSONObject(UcorePathUtil.FIREWALL).toJSONString())); + if (jsonObj.get(ClusterPathUtil.FIREWALL) != null) { + server.setFirewall(parseJsonFireWall.parseJsonToBean(jsonObj.getJSONObject(ClusterPathUtil.FIREWALL).toJSONString())); } - server.setVersion(jsonObj.getString(UcorePathUtil.VERSION)); - server.setSystem(parseJsonSystem.parseJsonToBean(jsonObj.getJSONObject(UcorePathUtil.DEFAULT).toJSONString())); - server.setUser(parseJsonUser.parseJsonToBean(jsonObj.getJSONArray(UcorePathUtil.USER).toJSONString())); - String path = ResourceUtil.getResourcePathFromRoot(UcorePathUtil.UCORE_LOCAL_WRITE_PATH); + server.setVersion(jsonObj.getString(ClusterPathUtil.VERSION)); + server.setSystem(parseJsonSystem.parseJsonToBean(jsonObj.getJSONObject(ClusterPathUtil.DEFAULT).toJSONString())); + server.setUser(parseJsonUser.parseJsonToBean(jsonObj.getJSONArray(ClusterPathUtil.USER).toJSONString())); + String path = ResourceUtil.getResourcePathFromRoot(ClusterPathUtil.UCORE_LOCAL_WRITE_PATH); path = new File(path).getPath() + File.separator; path += WRITEPATH; this.parseServerXMl.parseToXmlWrite(server, path, "server"); @@ -76,13 +78,13 @@ public class UXmlServerLoader implements UcoreXmlLoader { @Override public void notifyCluster() throws Exception { - Server servers = this.parseServerXMl.parseXmlToBean(UcorePathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH); + Server servers = this.parseServerXMl.parseXmlToBean(ClusterPathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH); JSONObject server = new JSONObject(); - server.put(UcorePathUtil.VERSION, servers.getVersion()); - server.put(UcorePathUtil.DEFAULT, servers.getSystem()); - server.put(UcorePathUtil.FIREWALL, servers.getFirewall()); - server.put(UcorePathUtil.USER, servers.getUser()); - ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, server.toJSONString()); + server.put(ClusterPathUtil.VERSION, servers.getVersion()); + server.put(ClusterPathUtil.DEFAULT, servers.getSystem()); + server.put(ClusterPathUtil.FIREWALL, servers.getFirewall()); + server.put(ClusterPathUtil.USER, servers.getUser()); + ClusterHelper.setKV(CONFIG_PATH, server.toJSONString()); } } diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/XmltoUcore.java b/src/main/java/com/actiontech/dble/cluster/xmltoKv/XmltoCluster.java similarity index 51% rename from src/main/java/com/actiontech/dble/config/loader/ucoreprocess/XmltoUcore.java rename to src/main/java/com/actiontech/dble/cluster/xmltoKv/XmltoCluster.java index c79fafd07..d1d7e41cf 100644 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/XmltoUcore.java +++ b/src/main/java/com/actiontech/dble/cluster/xmltoKv/XmltoCluster.java @@ -3,21 +3,21 @@ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. */ -package com.actiontech.dble.config.loader.ucoreprocess; +package com.actiontech.dble.cluster.xmltoKv; import com.actiontech.dble.cluster.ClusterController; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; -import com.actiontech.dble.config.loader.ucoreprocess.loader.*; +import com.actiontech.dble.cluster.listener.ClusterClearKeyListener; +import com.actiontech.dble.cluster.response.*; import com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase; /** * Created by szf on 2018/1/29. */ -public final class XmltoUcore { +public final class XmltoCluster { - private XmltoUcore() { + private XmltoCluster() { } @@ -28,21 +28,21 @@ public final class XmltoUcore { } public static void initFileToUcore() throws Exception { - UcoreClearKeyListener ucoreListen = new UcoreClearKeyListener(); + ClusterClearKeyListener ucoreListen = new ClusterClearKeyListener(); XmlProcessBase xmlProcess = new XmlProcessBase(); - new UXmlRuleLoader(xmlProcess, ucoreListen); + new XmlRuleLoader(xmlProcess, ucoreListen); - new UXmlServerLoader(xmlProcess, ucoreListen); + new XmlServerLoader(xmlProcess, ucoreListen); - new UXmlSchemaLoader(xmlProcess, ucoreListen); + new XmlSchemaLoader(xmlProcess, ucoreListen); - new UXmlEhcachesLoader(xmlProcess, ucoreListen); + new XmlEhcachesLoader(xmlProcess, ucoreListen); - new UCacheserviceResponse(ucoreListen); + new CacheserviceResponse(ucoreListen); - new UPropertySequenceLoader(ucoreListen); + new PropertySequenceLoader(ucoreListen); xmlProcess.initJaxbClass(); ucoreListen.initAllNode(); diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/ClusterUcoreSender.java b/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/ClusterUcoreSender.java deleted file mode 100644 index 30d310165..000000000 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/ClusterUcoreSender.java +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (C) 2016-2019 ActionTech. - * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. - */ - -package com.actiontech.dble.config.loader.ucoreprocess; - -import com.actiontech.dble.alarm.UcoreGrpc; -import com.actiontech.dble.alarm.UcoreInterface; -import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.KVtoXml.UcoreToXml; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; -import io.grpc.Channel; -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.LockSupport; - -import static com.actiontech.dble.cluster.ClusterController.GENERAL_GRPC_TIMEOUT; -import static com.actiontech.dble.cluster.ClusterController.GRPC_SUBTIMEOUT; - -/** - * Created by szf on 2018/1/26. - */ -public final class ClusterUcoreSender { - private static final Logger LOGGER = LoggerFactory.getLogger(UcoreXmlLoader.class); - - private ClusterUcoreSender() { - - } - - private static volatile UcoreGrpc.UcoreBlockingStub stub = null; - - { - Channel channel = ManagedChannelBuilder.forAddress(UcoreConfig.getInstance().getIpList().get(0), - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - } - - - public static void sendDataToUcore(String key, String value) throws Exception { - UcoreInterface.PutKvInput input = UcoreInterface.PutKvInput.newBuilder().setKey(key).setValue(value).build(); - try { - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).putKv(input); - } catch (Exception e1) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).putKv(input); - return; - } catch (Exception e2) { - LOGGER.info("connect to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - throw new IOException("ALL the ucore connect failure"); - } - } - - - public static String lockKey(String key, String value) throws Exception { - UcoreInterface.LockOnSessionInput input = UcoreInterface.LockOnSessionInput.newBuilder().setKey(key).setValue(value).setTTLSeconds(30).build(); - UcoreInterface.LockOnSessionOutput output = null; - - try { - output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).lockOnSession(input); - return output.getSessionId(); - } catch (Exception e1) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).lockOnSession(input); - return output.getSessionId(); - } catch (Exception e2) { - LOGGER.info("connect to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - } - throw new IOException("ALL the ucore connect failure"); - } - - static boolean renewLock(String sessionId) throws Exception { - UcoreInterface.RenewSessionInput input = UcoreInterface.RenewSessionInput.newBuilder().setSessionId(sessionId).build(); - try { - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).renewSession(input); - return true; - } catch (Exception e1) { - LOGGER.info("connect to ucore renew error and will retry"); - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).renewSession(input); - return true; - } catch (Exception e2) { - LOGGER.info("connect to ucore renew error " + stub, e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - return false; - } - } - - static void unlockKey(String key, String sessionId) { - UcoreInterface.UnlockOnSessionInput put = UcoreInterface.UnlockOnSessionInput.newBuilder().setKey(key).setSessionId(sessionId).build(); - try { - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).unlockOnSession(put); - } catch (Exception e) { - LOGGER.info(sessionId + " unlockKey " + key + " error ," + stub, e); - } - } - - public static List getKeyTree(String key) { - if (!(key.charAt(key.length() - 1) == '/')) { - key = key + "/"; - } - List result = new ArrayList(); - UcoreInterface.GetKvTreeInput input = UcoreInterface.GetKvTreeInput.newBuilder().setKey(key).build(); - - UcoreInterface.GetKvTreeOutput output = null; - - try { - output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKvTree(input); - } catch (Exception e1) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKvTree(input); - } catch (Exception e2) { - LOGGER.info("connect to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - if (output == null) { - throw new RuntimeException("ALL the ucore connect failure"); - } - } - - for (int i = 0; i < output.getKeysCount(); i++) { - UKvBean bean = new UKvBean(output.getKeys(i), output.getValues(i), output.getIndex()); - result.add(bean); - } - return result; - } - - public static UKvBean getKey(String key) { - UcoreInterface.GetKvInput input = UcoreInterface.GetKvInput.newBuilder().setKey(key).build(); - UcoreInterface.GetKvOutput output = null; - - try { - output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKv(input); - } catch (Exception e1) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKv(input); - } catch (Exception e2) { - LOGGER.info("connect to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - if (output == null) { - throw new RuntimeException("ALL the ucore connect failure"); - } - } - - UKvBean bean = new UKvBean(key, output.getValue(), 0); - return bean; - } - - - public static int getKeyTreeSize(String key) { - UcoreInterface.GetKvTreeInput input = UcoreInterface.GetKvTreeInput.newBuilder().setKey(key).build(); - UcoreInterface.GetKvTreeOutput output = null; - - try { - output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKvTree(input); - } catch (Exception e1) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - output = stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).getKvTree(input); - } catch (Exception e2) { - LOGGER.info("connect to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - if (output == null) { - throw new RuntimeException("ALL the ucore connect failure"); - } - } - return output.getKeysCount(); - } - - public static void deleteKVTree(String key) { - if (!(key.charAt(key.length() - 1) == '/')) { - key = key + "/"; - } - UcoreInterface.DeleteKvTreeInput input = UcoreInterface.DeleteKvTreeInput.newBuilder().setKey(key).build(); - try { - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKvTree(input); - } catch (Exception e1) { - boolean flag = false; - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKvTree(input); - flag = true; - } catch (Exception e2) { - LOGGER.info("connect to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - if (!flag) { - throw new RuntimeException("ALL the ucore connect failure"); - } - } - deleteKV(key.substring(0, key.length() - 1)); - } - - public static void deleteKV(String key) { - UcoreInterface.DeleteKvInput input = UcoreInterface.DeleteKvInput.newBuilder().setKey(key).build(); - try { - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKv(input); - } catch (Exception e1) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).deleteKv(input); - return; - } catch (Exception e2) { - LOGGER.info("connect to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - throw new RuntimeException("ALL the ucore connect failure"); - } - } - - - public static UcoreInterface.SubscribeKvPrefixOutput subscribeKvPrefix(UcoreInterface.SubscribeKvPrefixInput input) throws IOException { - try { - UcoreInterface.SubscribeKvPrefixOutput output = stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeKvPrefix(input); - return output; - } catch (Exception e1) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS); - UcoreInterface.SubscribeKvPrefixOutput output = stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeKvPrefix(input); - return output; - - } catch (Exception e2) { - LOGGER.info("connect to ucore at " + ip + " failure", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - } - throw new IOException("ALL the ucore connect failure"); - } - - - public static UcoreInterface.SubscribeNodesOutput subscribeNodes(UcoreInterface.SubscribeNodesInput subscribeNodesInput) throws IOException { - try { - return stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeNodes(subscribeNodesInput); - } catch (Exception e) { - //the first try failure ,try for all the other ucore ip - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, - Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS); - return stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeNodes(subscribeNodesInput); - } catch (Exception e2) { - LOGGER.info("try connection IP " + ip + " failure ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - } - throw new IOException("ALL the ucore connect failure"); - } - - - public static void alert(UcoreInterface.AlertInput input) { - try { - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alert(input); - } catch (Exception e) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alert(input); - return; - } catch (Exception e2) { - LOGGER.info("alert to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - } - } - } - } - - public static boolean alertResolve(UcoreInterface.AlertInput input) { - try { - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alertResolve(input); - return true; - } catch (Exception e) { - for (String ip : UcoreConfig.getInstance().getIpList()) { - ManagedChannel channel = null; - try { - channel = ManagedChannelBuilder.forAddress(ip, Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build(); - stub = UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS); - stub.withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS).alertResolve(input); - return true; - } catch (Exception e2) { - LOGGER.info("alertResolve to ucore error ", e2); - if (channel != null) { - channel.shutdownNow(); - } - return false; - } - } - return false; - } - } - - public static String waitingForAllTheNode(String checkString, String path) { - Map expectedMap = UcoreToXml.getOnlineMap(); - StringBuffer errorMsg = new StringBuffer(); - for (; ; ) { - errorMsg.setLength(0); - if (checkResponseForOneTime(checkString, path, expectedMap, errorMsg)) { - break; - } - LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(50)); - } - return errorMsg.length() <= 0 ? null : errorMsg.toString(); - } - - - public static boolean checkResponseForOneTime(String checkString, String path, Map expectedMap, StringBuffer errorMsg) { - Map currentMap = UcoreToXml.getOnlineMap(); - checkOnline(expectedMap, currentMap); - List responseList = ClusterUcoreSender.getKeyTree(path); - boolean flag = false; - for (Map.Entry entry : expectedMap.entrySet()) { - flag = false; - for (UKvBean uKvBean : responseList) { - String responseNode = last(uKvBean.getKey().split("/")); - if (last(entry.getKey().split("/")). - equals(responseNode)) { - if (checkString != null) { - if (!checkString.equals(uKvBean.getValue())) { - if (errorMsg != null) { - errorMsg.append(responseNode).append(":").append(uKvBean.getValue()).append(";"); - } - } - } - flag = true; - break; - } - } - if (!flag) { - break; - } - } - - return flag; - } - - - public static void checkOnline(Map expectedMap, Map currentMap) { - Iterator> iterator = expectedMap.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - if (!currentMap.containsKey(entry.getKey()) || - (currentMap.containsKey(entry.getKey()) && !currentMap.get(entry.getKey()).equals(entry.getValue()))) { - iterator.remove(); - } - } - - for (Map.Entry entry : currentMap.entrySet()) { - if (!expectedMap.containsKey(entry.getKey())) { - LOGGER.warn("NODE " + entry.getKey() + " IS NOT EXPECTED TO BE ONLINE,PLEASE CHECK IT "); - } - } - } - - public static T last(T[] array) { - return array[array.length - 1]; - } - - -} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/KVtoXml/UcoreToXml.java b/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/KVtoXml/UcoreToXml.java deleted file mode 100644 index d8e1f9fa5..000000000 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/KVtoXml/UcoreToXml.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2016-2019 ActionTech. - * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. - */ - -package com.actiontech.dble.config.loader.ucoreprocess.KVtoXml; - -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UOffLineListener; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreNodesListener; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreSingleKeyListener; -import com.actiontech.dble.config.loader.ucoreprocess.loader.*; -import com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase; - -import java.util.Map; - -import static com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil.SEPARATOR; - -/** - * Created by szf on 2018/1/24. - */ -public final class UcoreToXml { - - private static UcoreClearKeyListener listener = null; - - private static UcoreSingleKeyListener ddlListener = null; - - private static UcoreSingleKeyListener viewListener = null; - - private static UOffLineListener onlineListener = null; - - private static UcoreNodesListener ucoreNodesListener = null; - - private UcoreToXml() { - - } - - public static void loadKVtoFile() { - try { - //create a new listener to the ucore config change - listener = new UcoreClearKeyListener(); - XmlProcessBase xmlProcess = new XmlProcessBase(); - //add all loader into listener map list - new UXmlRuleLoader(xmlProcess, listener); - new UXmlSchemaLoader(xmlProcess, listener); - new UXmlServerLoader(xmlProcess, listener); - new UXmlEhcachesLoader(xmlProcess, listener); - new UCacheserviceResponse(listener); - new UPropertySequenceLoader(listener); - xmlProcess.initJaxbClass(); - - //add listener to watch the Prefix of the keys - new UConfigStatusResponse(listener); - new UBinlogPauseStatusResponse(listener); - new UPauseDataNodeResponse(listener); - - - ddlListener = new UcoreSingleKeyListener(UcorePathUtil.getDDLPath() + SEPARATOR, new UDdlChildResponse()); - - viewListener = new UcoreSingleKeyListener(UcorePathUtil.getViewChangePath() + SEPARATOR, new UViewChildResponse()); - - onlineListener = new UOffLineListener(); - - ucoreNodesListener = new UcoreNodesListener(); - - listener.initForXml(); - Thread thread = new Thread(listener); - thread.setName("UCORE_KEY_LISTENER"); - thread.start(); - - Thread thread2 = new Thread(ddlListener); - thread2.setName("DDL_UCORE_LISTENER"); - thread2.start(); - - Thread thread3 = new Thread(viewListener); - thread3.setName("VIEW_UCORE_LISTENER"); - thread3.start(); - - Thread thread4 = new Thread(onlineListener); - thread4.setName("ONLINE_UCORE_LISTENER"); - thread4.start(); - - Thread thread5 = new Thread(ucoreNodesListener); - thread5.setName("NODES_UCORE_LISTENER"); - thread5.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static UcoreClearKeyListener getListener() { - return listener; - } - - public static Map getOnlineMap() { - return onlineListener.copyOnlineMap(); - } -} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UDistributeLock.java b/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UDistributeLock.java deleted file mode 100644 index f6a0985ab..000000000 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UDistributeLock.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2016-2019 ActionTech. - * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. - */ - -package com.actiontech.dble.config.loader.ucoreprocess; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.LockSupport; - - -/** - * Created by szf on 2018/1/31. - */ -public class UDistributeLock { - - protected static final Logger LOGGER = LoggerFactory.getLogger(UDistributeLock.class); - private final int maxErrorCnt; - private int errorCount = 0; - private String path; - private String value; - private String session; - - private Thread renewThread; - - public UDistributeLock(String path, String value) { - this.path = path; - this.value = value; - this.maxErrorCnt = 3; - } - - public UDistributeLock(String path, String value, int maxErrorCnt) { - this.path = path; - this.value = value; - this.maxErrorCnt = maxErrorCnt; - } - - - public void release() { - if (renewThread != null) { - renewThread.interrupt(); - } - if (session != null) { - ClusterUcoreSender.unlockKey(path, session); - } - } - - public boolean acquire() { - try { - String sessionId = ClusterUcoreSender.lockKey(this.path, value); - if ("".equals(sessionId)) { - errorCount++; - if (errorCount == maxErrorCnt) { - throw new RuntimeException(" get lock from ucore error,ucore maybe offline "); - } - return false; - } - session = sessionId; - errorCount = 0; - renewThread = new Thread(new Runnable() { - @Override - public void run() { - String sessionId = session; - while (!Thread.currentThread().isInterrupted()) { - try { - LOGGER.debug("renew lock of session start:" + sessionId + " " + path); - if ("".equals(ClusterUcoreSender.getKey(path).getValue())) { - LOGGER.warn("renew lock of session failure:" + sessionId + " " + path + ", the key is missing "); - // alert - renewThread.interrupt(); - } else if (!ClusterUcoreSender.renewLock(sessionId)) { - LOGGER.warn("renew lock of session failure:" + sessionId + " " + path); - // alert - } else { - LOGGER.debug("renew lock of session success:" + sessionId + " " + path); - } - LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10000)); - } catch (Exception e) { - LOGGER.warn("renew lock of session failure:" + sessionId + " " + path, e); - LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(5000)); - } - } - } - }); - renewThread.setName("UCORE_RENEW_" + path); - renewThread.start(); - } catch (Exception e) { - LOGGER.warn(" get lock from ucore error", e); - errorCount++; - if (errorCount == maxErrorCnt) { - throw new RuntimeException(" get lock from ucore error,ucore maybe offline "); - } - return false; - } - return true; - } - - public String getPath() { - return path; - } -} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcoreConfig.java b/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcoreConfig.java deleted file mode 100644 index be21ec5ea..000000000 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcoreConfig.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2016-2019 ActionTech. - * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. - */ - -package com.actiontech.dble.config.loader.ucoreprocess; - -import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.KVtoXml.UcoreToXml; -import com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreNodesListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import static com.actiontech.dble.cluster.ClusterController.CONFIG_FILE_NAME; - - -/** - * Created by szf on 2018/1/24. - */ -public final class UcoreConfig { - private static final Logger LOGGER = LoggerFactory.getLogger(UcoreConfig.class); - private static UcoreConfig instance = new UcoreConfig(); - - - private List ipList = new ArrayList<>(); - - private Properties ucoreProperties = null; - - private UcoreConfig() { - - } - - public static UcoreConfig getInstance() { - return instance; - } - - public String getValue(ClusterParamCfg param) { - if (ucoreProperties != null && null != param) { - return ucoreProperties.getProperty(param.getKey()); - } - return null; - } - - - /** - * init the ucore and set keys - * - * @param cluterProperties - */ - public static void initUcore(Properties cluterProperties) { - try { - getInstance().ucoreProperties = cluterProperties; - for (String ip : cluterProperties.getProperty(ClusterParamCfg.CLUSTER_PLUGINS_IP.getKey()).split(",")) { - getInstance().ipList.add(ip); - } - UcoreToXml.loadKVtoFile(); - } catch (Exception e) { - LOGGER.error("error:", e); - } - } - - - /** - * init the ucore and set keys - * - * @param cluterProperties - */ - public static void initUcoreFromShell(Properties cluterProperties) { - try { - getInstance().ucoreProperties = cluterProperties; - for (String ip : cluterProperties.getProperty(ClusterParamCfg.CLUSTER_PLUGINS_IP.getKey()).split(",")) { - getInstance().ipList.add(ip); - } - } catch (Exception e) { - LOGGER.error("error:", e); - } - } - - public static void setUcoreProperties(Properties ucoreProperties) { - getInstance().ucoreProperties = ucoreProperties; - } - - public void setIpList(List ipList) { - this.ipList = ipList; - } - - public void setIp(String ips) { - getInstance().ucoreProperties.setProperty(ClusterParamCfg.CLUSTER_PLUGINS_IP.getKey(), ips); - FileOutputStream out = null; - try { - File file = new File(UcoreNodesListener.class.getResource(CONFIG_FILE_NAME).getFile()); - out = new FileOutputStream(file); - getInstance().ucoreProperties.store(out, ""); - } catch (Exception e) { - LOGGER.info("ips set to ucore failure"); - } finally { - try { - out.close(); - } catch (Exception e) { - LOGGER.info("open file error"); - } - } - } - - public List getIpList() { - return ipList; - } - - -} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcoreXmlLoader.java b/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcoreXmlLoader.java deleted file mode 100644 index 71ee09237..000000000 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/UcoreXmlLoader.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2016-2019 ActionTech. - * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. - */ - -package com.actiontech.dble.config.loader.ucoreprocess; - -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; - -/** - * Created by szf on 2018/1/26. - */ -public interface UcoreXmlLoader { - - void notifyProcess(UKvBean configValue) throws Exception; - - void notifyCluster() throws Exception; -} diff --git a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreNodesListener.java b/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreNodesListener.java deleted file mode 100644 index 6189b4c7a..000000000 --- a/src/main/java/com/actiontech/dble/config/loader/ucoreprocess/listen/UcoreNodesListener.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2016-2019 ActionTech. - * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. - */ - -package com.actiontech.dble.config.loader.ucoreprocess.listen; - - -import com.actiontech.dble.DbleServer; -import com.actiontech.dble.alarm.UcoreInterface; -import com.actiontech.dble.backend.mysql.view.CKVStoreRepository; -import com.actiontech.dble.backend.mysql.view.FileSystemRepository; -import com.actiontech.dble.backend.mysql.view.Repository; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.server.status.OnlineLockStatus; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - - -/** - * Created by szf on 2018/4/27. - */ -public class UcoreNodesListener implements Runnable { - - - private static final Logger LOGGER = LoggerFactory.getLogger(UcoreNodesListener.class); - private long index = 0; - - @Override - public void run() { - for (; ; ) { - try { - UcoreInterface.SubscribeNodesInput subscribeNodesInput = UcoreInterface.SubscribeNodesInput.newBuilder(). - setDuration(60).setIndex(index).build(); - UcoreInterface.SubscribeNodesOutput output = ClusterUcoreSender.subscribeNodes(subscribeNodesInput); - if (index != output.getIndex()) { - index = output.getIndex(); - List ips = new ArrayList<>(); - for (int i = 0; i < output.getIpsList().size(); i++) { - ips.add(output.getIps(i)); - } - UcoreConfig.getInstance().setIpList(ips); - UcoreConfig.getInstance().setIp(StringUtils.join(ips, ',')); - } - - if (DbleServer.getInstance().getTmManager().getRepository() instanceof FileSystemRepository) { - LOGGER.warn("Dble first reconnect to ucore ,local view repository change to CKVStoreRepository"); - Repository newViewRepository = new CKVStoreRepository(); - DbleServer.getInstance().getTmManager().setRepository(newViewRepository); - Map> viewCreateSqlMap = newViewRepository.getViewCreateSqlMap(); - DbleServer.getInstance().getTmManager().reloadViewMeta(viewCreateSqlMap); - //init online status - LOGGER.warn("Dble first reconnect to ucore ,online status rebuild"); - OnlineLockStatus.getInstance().metaUcoreInit(true); - } - } catch (Exception e) { - LOGGER.warn("error in ucore nodes watch,try for another time"); - } - } - } -} diff --git a/src/main/java/com/actiontech/dble/manager/response/DryRun.java b/src/main/java/com/actiontech/dble/manager/response/DryRun.java index 62c7b096b..d6f8e7970 100644 --- a/src/main/java/com/actiontech/dble/manager/response/DryRun.java +++ b/src/main/java/com/actiontech/dble/manager/response/DryRun.java @@ -8,11 +8,11 @@ package com.actiontech.dble.manager.response; import com.actiontech.dble.DbleServer; import com.actiontech.dble.backend.datasource.PhysicalDBNode; import com.actiontech.dble.backend.mysql.PacketUtil; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; import com.actiontech.dble.config.*; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; +import com.actiontech.dble.cluster.ClusterPathUtil; import com.actiontech.dble.config.model.SchemaConfig; import com.actiontech.dble.config.model.TableConfig; import com.actiontech.dble.config.model.UserConfig; @@ -115,7 +115,7 @@ public final class DryRun { userCheck(list, serverConfig); - if (DbleServer.getInstance().isUseUcore()) { + if (DbleServer.getInstance().isUseGeneralCluster()) { ucoreConnectionTest(list); } else { list.add(new ErrorInfo("Cluster", "NOTICE", "Dble is in single mod")); @@ -127,9 +127,9 @@ public final class DryRun { private static void ucoreConnectionTest(List list) { try { - String serverId = UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); - String selfPath = UcorePathUtil.getOnlinePath(serverId); - ClusterUcoreSender.getKey(selfPath); + String serverId = ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID); + String selfPath = ClusterPathUtil.getOnlinePath(serverId); + ClusterHelper.getKV(selfPath); } catch (Exception e) { list.add(new ErrorInfo("Cluster", "ERROR", "Dble in cluster but all the ucore can't connect")); } diff --git a/src/main/java/com/actiontech/dble/manager/response/KillDdlLock.java b/src/main/java/com/actiontech/dble/manager/response/KillDdlLock.java index 34f1f55d9..319788f1d 100644 --- a/src/main/java/com/actiontech/dble/manager/response/KillDdlLock.java +++ b/src/main/java/com/actiontech/dble/manager/response/KillDdlLock.java @@ -7,8 +7,8 @@ package com.actiontech.dble.manager.response; import com.actiontech.dble.DbleServer; import com.actiontech.dble.config.ErrorCode; -import com.actiontech.dble.config.loader.ucoreprocess.UDistrbtLockManager; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; +import com.actiontech.dble.cluster.DistrbtLockManager; +import com.actiontech.dble.cluster.ClusterPathUtil; import com.actiontech.dble.manager.ManagerConnection; import com.actiontech.dble.net.mysql.OkPacket; import com.actiontech.dble.util.StringUtil; @@ -37,8 +37,8 @@ public final class KillDdlLock { String schema = matcher.group(2); String table = matcher.group(4); // release distributed lock - if (DbleServer.getInstance().isUseUcore()) { - UDistrbtLockManager.releaseLock(UcorePathUtil.getDDLPath(StringUtil.getUFullName(schema, table))); + if (DbleServer.getInstance().isUseGeneralCluster()) { + DistrbtLockManager.releaseLock(ClusterPathUtil.getDDLPath(StringUtil.getUFullName(schema, table))); } boolean isRemoved = DbleServer.getInstance().getTmManager().removeMetaLock(schema, table); OkPacket packet = new OkPacket(); diff --git a/src/main/java/com/actiontech/dble/manager/response/PauseEnd.java b/src/main/java/com/actiontech/dble/manager/response/PauseEnd.java index 157be23ed..857700b85 100644 --- a/src/main/java/com/actiontech/dble/manager/response/PauseEnd.java +++ b/src/main/java/com/actiontech/dble/manager/response/PauseEnd.java @@ -5,12 +5,12 @@ package com.actiontech.dble.manager.response; import com.actiontech.dble.DbleServer; +import com.actiontech.dble.cluster.ClusterGeneralConfig; +import com.actiontech.dble.cluster.ClusterHelper; import com.actiontech.dble.cluster.ClusterParamCfg; +import com.actiontech.dble.cluster.ClusterPathUtil; +import com.actiontech.dble.cluster.bean.KvBean; import com.actiontech.dble.config.ErrorCode; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; -import com.actiontech.dble.config.loader.ucoreprocess.bean.UKvBean; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.PauseInfo; import com.actiontech.dble.manager.ManagerConnection; import com.actiontech.dble.net.mysql.OkPacket; @@ -44,11 +44,11 @@ public final class PauseEnd { public static void resume(ManagerConnection c) { - if (DbleServer.getInstance().isUseUcore()) { + if (DbleServer.getInstance().isUseGeneralCluster()) { try { - UKvBean value = ClusterUcoreSender.getKey(UcorePathUtil.getPauseDataNodePath()); + KvBean value = ClusterHelper.getKV(ClusterPathUtil.getPauseDataNodePath()); PauseInfo pauseInfo = new PauseInfo(value.getValue()); - if (!pauseInfo.getFrom().equals(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { + if (!pauseInfo.getFrom().equals(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) { c.writeErrMessage(ErrorCode.ER_UNKNOWN_ERROR, "This node is not the node which start pause"); return; } diff --git a/src/main/java/com/actiontech/dble/manager/response/ReloadConfig.java b/src/main/java/com/actiontech/dble/manager/response/ReloadConfig.java index a2ac78078..7eae30830 100644 --- a/src/main/java/com/actiontech/dble/manager/response/ReloadConfig.java +++ b/src/main/java/com/actiontech/dble/manager/response/ReloadConfig.java @@ -13,11 +13,11 @@ import com.actiontech.dble.backend.datasource.PhysicalDBPoolDiff; import com.actiontech.dble.backend.datasource.PhysicalDatasource; import com.actiontech.dble.backend.mysql.nio.MySQLConnection; import com.actiontech.dble.btrace.provider.ClusterDelayProvider; -import com.actiontech.dble.cluster.ClusterParamCfg; +import com.actiontech.dble.cluster.*; +import com.actiontech.dble.cluster.xmltoKv.XmltoCluster; import com.actiontech.dble.config.ConfigInitializer; import com.actiontech.dble.config.ErrorCode; import com.actiontech.dble.config.ServerConfig; -import com.actiontech.dble.config.loader.ucoreprocess.*; import com.actiontech.dble.config.loader.zkprocess.comm.ZkConfig; import com.actiontech.dble.config.loader.zkprocess.xmltozk.XmltoZkMain; import com.actiontech.dble.config.loader.zkprocess.zktoxml.listen.ConfigStatusListener; @@ -50,7 +50,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.ReentrantLock; -import static com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil.SEPARATOR; +import static com.actiontech.dble.cluster.ClusterPathUtil.SEPARATOR; /** * @author mycat @@ -99,21 +99,21 @@ public final class ReloadConfig { LOGGER.info("reload config using ZK failure", e); writeErrorResult(c, e.getMessage() == null ? e.toString() : e.getMessage()); } - } else if (DbleServer.getInstance().isUseUcore()) { - UDistributeLock distributeLock = new UDistributeLock(UcorePathUtil.getConfChangeLockPath(), - UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + } else if (DbleServer.getInstance().isUseGeneralCluster()) { + DistributeLock distributeLock = new DistributeLock(ClusterPathUtil.getConfChangeLockPath(), + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); try { if (!distributeLock.acquire()) { c.writeErrMessage(ErrorCode.ER_YES, "Other instance is reloading/rolling back, please try again later."); return; } - LOGGER.info("reload config: added distributeLock " + UcorePathUtil.getConfChangeLockPath() + " to ucore"); + LOGGER.info("reload config: added distributeLock " + ClusterPathUtil.getConfChangeLockPath() + " to ucore"); ClusterDelayProvider.delayAfterReloadLock(); try { reloadWithUcore(loadAll, loadAllMode, c); } finally { distributeLock.release(); - LOGGER.info("reload config: release distributeLock " + UcorePathUtil.getConfChangeLockPath() + " from ucore"); + LOGGER.info("reload config: release distributeLock " + ClusterPathUtil.getConfChangeLockPath() + " from ucore"); } } catch (Exception e) { LOGGER.info("reload config failure using ucore", e); @@ -155,23 +155,23 @@ public final class ReloadConfig { ClusterDelayProvider.delayAfterMasterLoad(); //step 3 if the reload with no error ,than write the config file into ucore remote - XmltoUcore.initFileToUcore(); + XmltoCluster.initFileToUcore(); LOGGER.info("reload config: sent config file to ucore"); //step 4 write the reload flag and self reload result into ucore,notify the other dble to reload - ConfStatus status = new ConfStatus(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), + ConfStatus status = new ConfStatus(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), loadAll ? ConfStatus.Status.RELOAD_ALL : ConfStatus.Status.RELOAD, loadAll ? String.valueOf(loadAllMode) : null); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getConfStatusPath(), status.toString()); + ClusterHelper.setKV(ClusterPathUtil.getConfStatusPath(), status.toString()); LOGGER.info("reload config: sent config status to ucore"); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getSelfConfStatusPath(), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(ClusterPathUtil.getSelfConfStatusPath(), ClusterPathUtil.SUCCESS); LOGGER.info("reload config: sent finished status to ucore, waiting other instances"); //step 5 start a loop to check if all the dble in cluster is reload finished - final String errorMsg = ClusterUcoreSender.waitingForAllTheNode(UcorePathUtil.SUCCESS, UcorePathUtil.getConfStatusPath() + SEPARATOR); + final String errorMsg = ClusterHelper.waitingForAllTheNode(ClusterPathUtil.SUCCESS, ClusterPathUtil.getConfStatusPath() + SEPARATOR); LOGGER.info("reload config: all instances finished "); ClusterDelayProvider.delayBeforeDeleteReloadLock(); //step 6 delete the reload flag - ClusterUcoreSender.deleteKVTree(UcorePathUtil.getConfStatusPath() + SEPARATOR); + ClusterHelper.cleanPath(ClusterPathUtil.getConfStatusPath() + SEPARATOR); if (errorMsg != null) { writeErrorResultForCluster(c, errorMsg); @@ -354,8 +354,6 @@ public final class ReloadConfig { /* 2.2 init the dataSource with diff*/ - - LOGGER.info("reload config: init new data host start"); boolean mergeReload = true; diff --git a/src/main/java/com/actiontech/dble/manager/response/RollbackConfig.java b/src/main/java/com/actiontech/dble/manager/response/RollbackConfig.java index f60252255..54284c843 100644 --- a/src/main/java/com/actiontech/dble/manager/response/RollbackConfig.java +++ b/src/main/java/com/actiontech/dble/manager/response/RollbackConfig.java @@ -9,10 +9,9 @@ import com.actiontech.dble.DbleServer; import com.actiontech.dble.backend.datasource.PhysicalDBNode; import com.actiontech.dble.backend.datasource.PhysicalDBPool; import com.actiontech.dble.btrace.provider.ClusterDelayProvider; -import com.actiontech.dble.cluster.ClusterParamCfg; +import com.actiontech.dble.cluster.*; import com.actiontech.dble.config.ErrorCode; import com.actiontech.dble.config.ServerConfig; -import com.actiontech.dble.config.loader.ucoreprocess.*; import com.actiontech.dble.config.loader.zkprocess.comm.ZkConfig; import com.actiontech.dble.config.loader.zkprocess.xmltozk.XmltoZkMain; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ConfStatus; @@ -37,7 +36,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.ReentrantLock; -import static com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil.SEPARATOR; +import static com.actiontech.dble.cluster.ClusterPathUtil.SEPARATOR; /** @@ -68,9 +67,9 @@ public final class RollbackConfig { LOGGER.info("reload config failure", e); writeErrorResult(c, e.getMessage() == null ? e.toString() : e.getMessage()); } - } else if (DbleServer.getInstance().isUseUcore()) { - UDistributeLock distributeLock = new UDistributeLock(UcorePathUtil.getConfChangeLockPath(), - UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + } else if (DbleServer.getInstance().isUseGeneralCluster()) { + DistributeLock distributeLock = new DistributeLock(ClusterPathUtil.getConfChangeLockPath(), + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); try { if (!distributeLock.acquire()) { @@ -113,18 +112,18 @@ public final class RollbackConfig { ClusterDelayProvider.delayAfterMasterRollback(); //step 3 tail the ucore & notify the other dble - ConfStatus status = new ConfStatus(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), ConfStatus.Status.ROLLBACK, null); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getConfStatusPath(), status.toString()); + ConfStatus status = new ConfStatus(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), ConfStatus.Status.ROLLBACK, null); + ClusterHelper.setKV(ClusterPathUtil.getConfStatusPath(), status.toString()); //step 4 set self status success - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getSelfConfStatusPath(), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(ClusterPathUtil.getSelfConfStatusPath(), ClusterPathUtil.SUCCESS); - String errorMsg = ClusterUcoreSender.waitingForAllTheNode(UcorePathUtil.SUCCESS, UcorePathUtil.getConfStatusPath() + SEPARATOR); + String errorMsg = ClusterHelper.waitingForAllTheNode(ClusterPathUtil.SUCCESS, ClusterPathUtil.getConfStatusPath() + SEPARATOR); ClusterDelayProvider.delayBeforeDeleterollbackLock(); //step 6 delete the reload flag - ClusterUcoreSender.deleteKVTree(UcorePathUtil.getConfStatusPath()); + ClusterHelper.cleanPath(ClusterPathUtil.getConfStatusPath()); if (errorMsg != null) { throw new RuntimeException(errorMsg); diff --git a/src/main/java/com/actiontech/dble/manager/response/ShowBinlogStatus.java b/src/main/java/com/actiontech/dble/manager/response/ShowBinlogStatus.java index 258f6b390..091ea2e5f 100644 --- a/src/main/java/com/actiontech/dble/manager/response/ShowBinlogStatus.java +++ b/src/main/java/com/actiontech/dble/manager/response/ShowBinlogStatus.java @@ -9,14 +9,11 @@ import com.actiontech.dble.DbleServer; import com.actiontech.dble.backend.datasource.PhysicalDBPool; import com.actiontech.dble.backend.datasource.PhysicalDatasource; import com.actiontech.dble.backend.mysql.PacketUtil; -import com.actiontech.dble.cluster.ClusterParamCfg; +import com.actiontech.dble.cluster.*; import com.actiontech.dble.config.ErrorCode; import com.actiontech.dble.config.Fields; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.KVtoXml.UcoreToXml; -import com.actiontech.dble.config.loader.ucoreprocess.UDistributeLock; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; +import com.actiontech.dble.cluster.kVtoXml.ClusterToXml; +import com.actiontech.dble.cluster.ClusterPathUtil; import com.actiontech.dble.config.loader.zkprocess.comm.ZkConfig; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.BinlogPause; import com.actiontech.dble.manager.ManagerConnection; @@ -50,7 +47,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.LockSupport; -import static com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil.SEPARATOR; +import static com.actiontech.dble.cluster.ClusterPathUtil.SEPARATOR; import static com.actiontech.dble.config.loader.zkprocess.zookeeper.process.BinlogPause.BinlogPauseStatus; public final class ShowBinlogStatus { @@ -87,7 +84,7 @@ public final class ShowBinlogStatus { long timeout = DbleServer.getInstance().getConfig().getSystem().getShowBinlogStatusTimeout(); if (isUseZK) { showBinlogWithZK(c, timeout); - } else if (DbleServer.getInstance().isUseUcore()) { + } else if (DbleServer.getInstance().isUseGeneralCluster()) { showBinlogWithUcore(c, timeout); } else { if (!DbleServer.getInstance().getBackupLocked().compareAndSet(false, true)) { @@ -110,7 +107,7 @@ public final class ShowBinlogStatus { private static void showBinlogWithUcore(ManagerConnection c, long timeout) { //step 1 get the distributeLock of the ucore - UDistributeLock distributeLock = new UDistributeLock(UcorePathUtil.getBinlogPauseLockPath(), UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + DistributeLock distributeLock = new DistributeLock(ClusterPathUtil.getBinlogPauseLockPath(), ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); try { if (!distributeLock.acquire()) { c.writeErrMessage(ErrorCode.ER_UNKNOWN_ERROR, "There is another command is showing BinlogStatus"); @@ -122,7 +119,7 @@ public final class ShowBinlogStatus { c.writeErrMessage(ErrorCode.ER_UNKNOWN_ERROR, "There is another command is showing BinlogStatus"); } else { //step 3 notify other dble to stop the commit & set self status - BinlogPause pauseOnInfo = new BinlogPause(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), BinlogPauseStatus.ON); + BinlogPause pauseOnInfo = new BinlogPause(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), BinlogPauseStatus.ON); //step 4 wait til other dbles to feedback the ucore flag long beginTime = TimeUtil.currentTimeMillis(); @@ -131,13 +128,13 @@ public final class ShowBinlogStatus { writeResponse(c); return; } - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getBinlogPauseStatus(), pauseOnInfo.toString()); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getBinlogPauseStatusSelf(), UcorePathUtil.SUCCESS); + ClusterHelper.setKV(ClusterPathUtil.getBinlogPauseStatus(), pauseOnInfo.toString()); + ClusterHelper.setKV(ClusterPathUtil.getBinlogPauseStatusSelf(), ClusterPathUtil.SUCCESS); - Map expectedMap = UcoreToXml.getOnlineMap(); + Map expectedMap = ClusterToXml.getOnlineMap(); while (true) { StringBuffer errorStringBuf = new StringBuffer(); - if (ClusterUcoreSender.checkResponseForOneTime(UcorePathUtil.SUCCESS, UcorePathUtil.getBinlogPauseStatus(), expectedMap, errorStringBuf)) { + if (ClusterHelper.checkResponseForOneTime(ClusterPathUtil.SUCCESS, ClusterPathUtil.getBinlogPauseStatus(), expectedMap, errorStringBuf)) { errMsg = errorStringBuf.length() <= 0 ? null : errorStringBuf.toString(); break; } else if (TimeUtil.currentTimeMillis() > beginTime + 2 * timeout) { @@ -154,9 +151,9 @@ public final class ShowBinlogStatus { writeResponse(c); //step 7 delete the KVtree and notify the cluster - ClusterUcoreSender.deleteKVTree(UcorePathUtil.getBinlogPauseStatus() + SEPARATOR); - BinlogPause pauseOffInfo = new BinlogPause(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), BinlogPauseStatus.OFF); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getBinlogPauseStatus(), pauseOffInfo.toString()); + ClusterHelper.cleanPath(ClusterPathUtil.getBinlogPauseStatus() + SEPARATOR); + BinlogPause pauseOffInfo = new BinlogPause(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), BinlogPauseStatus.OFF); + ClusterHelper.setKV(ClusterPathUtil.getBinlogPauseStatus(), pauseOffInfo.toString()); } } catch (Exception e) { diff --git a/src/main/java/com/actiontech/dble/meta/PauseDatanodeManager.java b/src/main/java/com/actiontech/dble/meta/PauseDatanodeManager.java index e9f2f0415..67e442c3a 100644 --- a/src/main/java/com/actiontech/dble/meta/PauseDatanodeManager.java +++ b/src/main/java/com/actiontech/dble/meta/PauseDatanodeManager.java @@ -6,12 +6,9 @@ package com.actiontech.dble.meta; import com.actiontech.dble.DbleServer; import com.actiontech.dble.backend.BackendConnection; -import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.KVtoXml.UcoreToXml; -import com.actiontech.dble.config.loader.ucoreprocess.UDistributeLock; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; +import com.actiontech.dble.cluster.*; +import com.actiontech.dble.cluster.kVtoXml.ClusterToXml; +import com.actiontech.dble.cluster.ClusterPathUtil; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.PauseInfo; import com.actiontech.dble.config.model.SchemaConfig; import com.actiontech.dble.config.model.TableConfig; @@ -44,7 +41,7 @@ public class PauseDatanodeManager { private volatile Set dataNodes = null; private Map> pauseMap = new ConcurrentHashMap<>(); private AtomicBoolean isPausing = new AtomicBoolean(false); - private UDistributeLock uDistributeLock = null; + private DistributeLock uDistributeLock = null; private volatile PauseEndThreadPool pauseThreadPool = null; @@ -185,16 +182,16 @@ public class PauseDatanodeManager { public boolean clusterPauseNotic(String dataNode, int timeOut, int queueLimit) { - if (DbleServer.getInstance().isUseUcore()) { + if (DbleServer.getInstance().isUseGeneralCluster()) { try { - uDistributeLock = new UDistributeLock(UcorePathUtil.getPauseDataNodePath(), - new PauseInfo(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), dataNode, PAUSE, timeOut, queueLimit).toString()); + uDistributeLock = new DistributeLock(ClusterPathUtil.getPauseDataNodePath(), + new PauseInfo(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), dataNode, PAUSE, timeOut, queueLimit).toString()); if (!uDistributeLock.acquire()) { return false; } - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getPauseResultNodePath(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), - UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + ClusterHelper.setKV(ClusterPathUtil.getPauseResultNodePath(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); } catch (Exception e) { LOGGER.info("ucore connecction error", e); return false; @@ -206,10 +203,10 @@ public class PauseDatanodeManager { public boolean waitForCluster(ManagerConnection c, long beginTime, long timeOut) throws Exception { - if (DbleServer.getInstance().isUseUcore()) { - Map expectedMap = UcoreToXml.getOnlineMap(); + if (DbleServer.getInstance().isUseGeneralCluster()) { + Map expectedMap = ClusterToXml.getOnlineMap(); for (; ; ) { - if (ClusterUcoreSender.checkResponseForOneTime(null, UcorePathUtil.getPauseResultNodePath(), expectedMap, null)) { + if (ClusterHelper.checkResponseForOneTime(null, ClusterPathUtil.getPauseResultNodePath(), expectedMap, null)) { return true; } else if (System.currentTimeMillis() - beginTime > timeOut) { DbleServer.getInstance().getMiManager().resume(); @@ -224,24 +221,24 @@ public class PauseDatanodeManager { public void resumeCluster() throws Exception { - if (DbleServer.getInstance().isUseUcore()) { - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getPauseResumePath(), - new PauseInfo(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), " ", PauseInfo.RESUME, 0, 0).toString()); + if (DbleServer.getInstance().isUseGeneralCluster()) { + ClusterHelper.setKV(ClusterPathUtil.getPauseResumePath(), + new PauseInfo(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), " ", PauseInfo.RESUME, 0, 0).toString()); //send self reponse - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getPauseResumePath(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), - UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); + ClusterHelper.setKV(ClusterPathUtil.getPauseResumePath(ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), + ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID)); - ClusterUcoreSender.waitingForAllTheNode(null, UcorePathUtil.getPauseResumePath()); + ClusterHelper.waitingForAllTheNode(null, ClusterPathUtil.getPauseResumePath()); DbleServer.getInstance().getMiManager().getuDistributeLock().release(); - ClusterUcoreSender.deleteKVTree(UcorePathUtil.getPauseDataNodePath()); + ClusterHelper.cleanPath(ClusterPathUtil.getPauseDataNodePath()); } } - private UDistributeLock getuDistributeLock() { + private DistributeLock getuDistributeLock() { return uDistributeLock; } diff --git a/src/main/java/com/actiontech/dble/meta/ProxyMetaManager.java b/src/main/java/com/actiontech/dble/meta/ProxyMetaManager.java index c8186dd49..62a2cd34d 100644 --- a/src/main/java/com/actiontech/dble/meta/ProxyMetaManager.java +++ b/src/main/java/com/actiontech/dble/meta/ProxyMetaManager.java @@ -17,10 +17,9 @@ import com.actiontech.dble.backend.mysql.view.FileSystemRepository; import com.actiontech.dble.backend.mysql.view.KVStoreRepository; import com.actiontech.dble.backend.mysql.view.Repository; import com.actiontech.dble.btrace.provider.ClusterDelayProvider; -import com.actiontech.dble.cluster.ClusterParamCfg; +import com.actiontech.dble.cluster.*; import com.actiontech.dble.config.ErrorCode; import com.actiontech.dble.config.ServerConfig; -import com.actiontech.dble.config.loader.ucoreprocess.*; import com.actiontech.dble.config.loader.zkprocess.comm.ZkConfig; import com.actiontech.dble.config.loader.zkprocess.zookeeper.process.DDLInfo; import com.actiontech.dble.config.model.DBHostConfig; @@ -410,7 +409,7 @@ public class ProxyMetaManager { handler.execute(); if (DbleServer.getInstance().isUseZK()) { loadViewFromKV(); - } else if (DbleServer.getInstance().isUseUcore()) { + } else if (DbleServer.getInstance().isUseGeneralCluster()) { loadViewFromCKV(); } else { loadViewFromFile(); @@ -496,19 +495,18 @@ public class ProxyMetaManager { String nodePath = ZKPaths.makePath(KVPathUtil.getDDLPath(), nodeName); zkConn.create().forPath(nodePath, ddlInfo.toString().getBytes(StandardCharsets.UTF_8)); ClusterDelayProvider.delayAfterDdlLockMeta(); - } else if (DbleServer.getInstance().isUseUcore()) { - DDLInfo ddlInfo = new DDLInfo(schema, sql, UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), DDLInfo.DDLStatus.INIT, DDLInfo.DDLType.UNKNOWN); + } else if (DbleServer.getInstance().isUseGeneralCluster()) { + DDLInfo ddlInfo = new DDLInfo(schema, sql, ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), DDLInfo.DDLStatus.INIT, DDLInfo.DDLType.UNKNOWN); String nodeName = StringUtil.getUFullName(schema, table); - String ddlPath = UcorePathUtil.getDDLPath(nodeName); - UDistributeLock lock = new UDistributeLock(ddlPath, ddlInfo.toString()); - //ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getDDLPath(nodeName), ddlInfo.toString()); + String ddlPath = ClusterPathUtil.getDDLPath(nodeName); + DistributeLock lock = new DistributeLock(ddlPath, ddlInfo.toString()); if (!lock.acquire()) { String msg = "The syncMeta.lock or metaLock about " + nodeName + " in " + ddlPath + "is Exists"; LOGGER.info(msg); throw new Exception(msg); } ClusterDelayProvider.delayAfterDdlLockMeta(); - UDistrbtLockManager.addLock(lock); + DistrbtLockManager.addLock(lock); } } @@ -517,7 +515,7 @@ public class ProxyMetaManager { ClusterDelayProvider.delayAfterDdlExecuted(); if (DbleServer.getInstance().isUseZK()) { notifyResponseZKDdl(schema, table, sql, ddlStatus, ddlType, needNotifyOther); - } else if (DbleServer.getInstance().isUseUcore()) { + } else if (DbleServer.getInstance().isUseGeneralCluster()) { notifyReponseUcoreDDL(schema, table, sql, ddlStatus, ddlType, needNotifyOther); } } @@ -560,15 +558,15 @@ public class ProxyMetaManager { */ public void notifyReponseUcoreDDL(String schema, String table, String sql, DDLInfo.DDLStatus ddlStatus, DDLInfo.DDLType ddlType, boolean needNotifyOther) throws Exception { String nodeName = StringUtil.getUFullName(schema, table); - DDLInfo ddlInfo = new DDLInfo(schema, sql, UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), ddlStatus, ddlType); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getDDLInstancePath(nodeName), UcorePathUtil.SUCCESS); + DDLInfo ddlInfo = new DDLInfo(schema, sql, ClusterGeneralConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), ddlStatus, ddlType); + ClusterHelper.setKV(ClusterPathUtil.getDDLInstancePath(nodeName), ClusterPathUtil.SUCCESS); if (needNotifyOther) { try { ClusterDelayProvider.delayBeforeDdlNotice(); - ClusterUcoreSender.sendDataToUcore(UcorePathUtil.getDDLPath(nodeName), ddlInfo.toString()); + ClusterHelper.setKV(ClusterPathUtil.getDDLPath(nodeName), ddlInfo.toString()); ClusterDelayProvider.delayAfterDdlNotice(); - String errorMsg = ClusterUcoreSender.waitingForAllTheNode(UcorePathUtil.SUCCESS, UcorePathUtil.getDDLPath(nodeName)); + String errorMsg = ClusterHelper.waitingForAllTheNode(ClusterPathUtil.SUCCESS, ClusterPathUtil.getDDLPath(nodeName)); if (errorMsg != null) { throw new RuntimeException(errorMsg); @@ -577,10 +575,10 @@ public class ProxyMetaManager { throw e; } finally { ClusterDelayProvider.delayBeforeDdlNoticeDeleted(); - ClusterUcoreSender.deleteKVTree(UcorePathUtil.getDDLPath(nodeName) + "/"); + ClusterHelper.cleanPath(ClusterPathUtil.getDDLPath(nodeName) + "/"); //release the lock ClusterDelayProvider.delayBeforeDdlLockRelease(); - UDistrbtLockManager.releaseLock(UcorePathUtil.getDDLPath(nodeName)); + DistrbtLockManager.releaseLock(ClusterPathUtil.getDDLPath(nodeName)); } } diff --git a/src/main/java/com/actiontech/dble/server/ServerConnection.java b/src/main/java/com/actiontech/dble/server/ServerConnection.java index d0b0304f0..dacd4ac62 100644 --- a/src/main/java/com/actiontech/dble/server/ServerConnection.java +++ b/src/main/java/com/actiontech/dble/server/ServerConnection.java @@ -359,7 +359,7 @@ public class ServerConnection extends FrontendConnection { throw new Exception(msg); } DbleServer.getInstance().getTmManager().notifyClusterDDL(schema, table, rrs.getStatement()); - } else if (DbleServer.getInstance().isUseUcore()) { + } else if (DbleServer.getInstance().isUseGeneralCluster()) { DbleServer.getInstance().getTmManager().notifyClusterDDL(schema, table, rrs.getStatement()); } } catch (SQLNonTransientException e) { diff --git a/src/main/java/com/actiontech/dble/server/status/OnlineLockStatus.java b/src/main/java/com/actiontech/dble/server/status/OnlineLockStatus.java index fac3cff80..7dda9c417 100644 --- a/src/main/java/com/actiontech/dble/server/status/OnlineLockStatus.java +++ b/src/main/java/com/actiontech/dble/server/status/OnlineLockStatus.java @@ -5,11 +5,8 @@ package com.actiontech.dble.server.status; -import com.actiontech.dble.cluster.ClusterParamCfg; -import com.actiontech.dble.config.loader.ucoreprocess.ClusterUcoreSender; -import com.actiontech.dble.config.loader.ucoreprocess.UDistributeLock; -import com.actiontech.dble.config.loader.ucoreprocess.UcoreConfig; -import com.actiontech.dble.config.loader.ucoreprocess.UcorePathUtil; +import com.actiontech.dble.cluster.*; +import com.actiontech.dble.cluster.DistributeLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,7 +16,7 @@ import java.util.concurrent.locks.LockSupport; public final class OnlineLockStatus { private static final Logger LOGGER = LoggerFactory.getLogger(OnlineLockStatus.class); - private volatile UDistributeLock onlineLock = null; + private volatile DistributeLock onlineLock = null; private volatile boolean onlineInited = false; private OnlineLockStatus() { @@ -36,12 +33,12 @@ public final class OnlineLockStatus { return false; } //check if the online mark is on than delete the mark and renew it - ClusterUcoreSender.deleteKV(UcorePathUtil.getOnlinePath(UcoreConfig.getInstance(). + ClusterHelper.cleanKV(ClusterPathUtil.getOnlinePath(ClusterGeneralConfig.getInstance(). getValue(ClusterParamCfg.CLUSTER_CFG_MYID))); if (onlineLock != null) { onlineLock.release(); } - onlineLock = new UDistributeLock(UcorePathUtil.getOnlinePath(UcoreConfig.getInstance(). + onlineLock = new DistributeLock(ClusterPathUtil.getOnlinePath(ClusterGeneralConfig.getInstance(). getValue(ClusterParamCfg.CLUSTER_CFG_MYID)), "" + System.currentTimeMillis(), 6); int time = 0;