Github user milleruntime commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/279#discussion_r126734863
  
    --- Diff: 
core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java ---
    @@ -100,50 +106,150 @@ private static ZooCache getZooCache(Instance 
instance) {
         return namespaceMap;
       }
     
    -  public static boolean exists(Instance instance, String namespaceId) {
    +  public static boolean exists(Instance instance, Namespace.ID 
namespaceId) {
         ZooCache zc = getZooCache(instance);
         List<String> namespaceIds = zc.getChildren(ZooUtil.getRoot(instance) + 
Constants.ZNAMESPACES);
    -    return namespaceIds.contains(namespaceId);
    -  }
    -
    -  public static String getNamespaceId(Instance instance, String namespace) 
throws NamespaceNotFoundException {
    -    String id = getNameToIdMap(instance).get(namespace);
    -    if (id == null)
    -      throw new NamespaceNotFoundException(null, namespace, 
"getNamespaceId() failed to find namespace");
    -    return id;
    +    return namespaceIds.contains(namespaceId.canonicalID());
       }
     
    +  /**
    +   * @deprecated Do not use - String for namespace ID is not type safe. 
Use {@link #getNamespaceName(Instance, Namespace.ID)}
    +   */
    +  @Deprecated
    --- End diff --
    
    I kept the deprecated methods around because of the 2 API methods 
NamespaceOperations Map<String,String> namespaceIdMap() and TableOperations 
Map<String,String> tableIdMap().  If I remove the deprecated methods then I 
either have to make populateMap(Instance, BiConsumer<String,String>) public or 
create a similar method that returns Map<String,String>.  I figured at least 
with the methods deprecated, we can communicate the preferred methods.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to