docs: public static Deferred<Branch> loadOrInitializeRoot(final TSDB tsdb, 
        final int tree_id, final boolean is_testing) {
  
      /**
       * Final callback executed after the storage put completed. It also caches
       * the root branch so we don't keep calling and re-calling it, returning a
       * copy for the local TreeBuilder to use
       */
      final class NewRootCB implements Callback<Deferred<Branch>, 
      ArrayList<Boolean>> {
  
        final Branch root;
        
        public NewRootCB(final Branch root) {
          this.root = root;
        }
        
        @Override
        public Deferred<Branch> call(final ArrayList<Boolean> storage_call) 
          throws Exception {
          LOG.info("Initialized root branch for tree: " + tree_id);
          tree_roots.put(tree_id, root);
          return Deferred.fromResult(new Branch(root));
        }
        
      }
      
      /**
       * Called after attempting to fetch the branch. If the branch didn't exist
       * then we'll create a new one and save it if told to
       */
      final class RootCB implements Callback<Deferred<Branch>, Branch> {
  
        @Override
        public Deferred<Branch> call(final Branch branch) throws Exception {
          if (branch == null) {
            LOG.info("Couldn't find the root branch, initializing");
            final Branch root = new Branch(tree_id);
            root.setDisplayName("ROOT");
            final TreeMap<Integer, String> root_path = 
              new TreeMap<Integer, String>();
            root_path.put(0, "ROOT");
            root.prependParentPath(root_path);
            if (is_testing) {
              return Deferred.fromResult(root);
            } else {
              return root.storeBranch(tsdb, null, true).addCallbackDeferring(
                  new NewRootCB(root));
            }
          } else {
            return Deferred.fromResult(branch);
          }
        }
        
      }
      
      // if the root is already in cache, return it
      final Branch cached = tree_roots.get(tree_id);
      if (cached != null) {
        LOG.debug("Loaded cached root for tree: " + tree_id);
        return Deferred.fromResult(new Branch(cached));
      }
      
      LOG.debug("Loading or initializing root for tree: " + tree_id);
      return Branch.fetchBranchOnly(tsdb, Tree.idToBytes(tree_id))
        .addCallbackDeferring(new RootCB());
    }