keith-turner commented on code in PR #4996:
URL: https://github.com/apache/accumulo/pull/4996#discussion_r1816786372
##########
core/src/main/java/org/apache/accumulo/core/clientImpl/Namespaces.java:
##########
@@ -70,57 +65,31 @@ public static List<String> getTableNames(ClientContext
context, NamespaceId name
return names;
}
- /**
- * Gets all the namespaces from ZK. The first arg (t) the BiConsumer accepts
is the ID and the
- * second (u) is the namespaceName.
- */
- private static void getAllNamespaces(ClientContext context,
- BiConsumer<String,String> biConsumer) {
- final ZooCache zc = context.getZooCache();
- List<String> namespaceIds = zc.getChildren(context.getZooKeeperRoot() +
Constants.ZNAMESPACES);
- for (String id : namespaceIds) {
- byte[] path = zc.get(context.getZooKeeperRoot() + Constants.ZNAMESPACES
+ "/" + id
- + Constants.ZNAMESPACE_NAME);
- if (path != null) {
- biConsumer.accept(id, new String(path, UTF_8));
- }
- }
- }
-
/**
* Return sorted map with key = ID, value = namespaceName
*/
public static SortedMap<NamespaceId,String> getIdToNameMap(ClientContext
context) {
- SortedMap<NamespaceId,String> idMap = new TreeMap<>();
- getAllNamespaces(context, (id, name) -> idMap.put(NamespaceId.of(id),
name));
- return idMap;
+ return context.getNamespaces().getIdToNameMap();
Review Comment:
> It's probably best to do that stuff as a follow-on, and just limit this PR
to changing the implementation of these methods.
That would be best as follow on.
--
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]