acelyc111 commented on code in PR #1471:
URL:
https://github.com/apache/incubator-pegasus/pull/1471#discussion_r1195124927
##########
java-client/src/main/java/org/apache/pegasus/client/PegasusAdminClient.java:
##########
@@ -230,4 +232,26 @@ public void dropApp(String appName, int reserveSeconds)
throws PException {
String.format("Drop app:%s failed! error: %s.", appName,
error.toString()));
}
}
+
+ @Override
+ public List<app_info> listApps(ListAppInfoType listAppInfoType) throws
PException {
+ configuration_list_apps_request request = new
configuration_list_apps_request();
+ request.setStatus(app_status.AS_AVAILABLE);
+ if (listAppInfoType == ListAppInfoType.LT_GET_ALL_APPS) {
+ request.setStatus(app_status.AS_INVALID);
Review Comment:
Add some comments to explain that all apps will be returned if set as
`AS_INVALID`.
##########
java-client/src/main/java/org/apache/pegasus/client/PegasusAdminClientInterface.java:
##########
@@ -71,6 +73,17 @@ public void createApp(
public void dropApp(String appName, int reserveSeconds) throws PException;
+ /**
+ * Get all app names of the pegasus cluster
+ *
+ * @param onlyGetAvailableApps Whether to return all available tables, true
means to return only
+ * available tables, false means to return all tables, including dropped
but currently
+ * reserved tables
+ * @param appInfoList List of all 'app_info' in the pegasus cluster
Review Comment:
```suggestion
* @return appInfoList List of 'app_info' in the Pegasus cluster
```
##########
java-client/src/main/java/org/apache/pegasus/client/ListAppInfoType.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pegasus.client;
+
+public enum ListAppInfoType {
+ LT_ONLY_GET_AVAILABLE_APPS(0),
+ LT_GET_ALL_APPS(1);
Review Comment:
Because the type name contains "List...", so how about omitted the "get"
word?
```suggestion
LT_AVAILABLE_APPS(0),
LT_ALL_APPS(1);
```
##########
java-client/src/main/java/org/apache/pegasus/client/PegasusAdminClientInterface.java:
##########
@@ -71,6 +73,17 @@ public void createApp(
public void dropApp(String appName, int reserveSeconds) throws PException;
+ /**
+ * Get all app names of the pegasus cluster
Review Comment:
```suggestion
* Get app names in the Pegasus cluster
```
##########
java-client/src/main/java/org/apache/pegasus/client/PegasusAdminClientInterface.java:
##########
@@ -71,6 +73,17 @@ public void createApp(
public void dropApp(String appName, int reserveSeconds) throws PException;
+ /**
+ * Get all app names of the pegasus cluster
+ *
+ * @param onlyGetAvailableApps Whether to return all available tables, true
means to return only
Review Comment:
Update the comments since the parameter has changed.
##########
java-client/src/main/java/org/apache/pegasus/client/PegasusAdminClient.java:
##########
@@ -230,4 +232,26 @@ public void dropApp(String appName, int reserveSeconds)
throws PException {
String.format("Drop app:%s failed! error: %s.", appName,
error.toString()));
}
}
+
+ @Override
+ public List<app_info> listApps(ListAppInfoType listAppInfoType) throws
PException {
+ configuration_list_apps_request request = new
configuration_list_apps_request();
+ request.setStatus(app_status.AS_AVAILABLE);
+ if (listAppInfoType == ListAppInfoType.LT_GET_ALL_APPS) {
+ request.setStatus(app_status.AS_INVALID);
+ }
+
+ list_apps_operator app_operator = new list_apps_operator(request);
+ error_code.error_types error = this.meta.operate(app_operator,
META_RETRY_MIN_COUNT);
+
+ if (error != error_code.error_types.ERR_OK) {
+ throw new PException(
+ String.format(
+ "List apps failed, query status:%s, error:%s.",
Review Comment:
```suggestion
"List apps failed, query status: %s, error: %s.",
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]