code: func (ts *Store) Render(key string, rebuild bool) (id string, hash string, err error) {
  	id, err = ts.GetID(key)
  	if err != nil {
  		return "", "", errwrap.Wrap(errors.New("cannot calculate treestore id"), err)
  	}
  
  	// this lock references the treestore dir for the specified id.
  	treeStoreKeyLock, err := lock.ExclusiveKeyLock(ts.lockDir, id)
  	if err != nil {
  		return "", "", errwrap.Wrap(errors.New("error locking tree store"), err)
  	}
  	defer treeStoreKeyLock.Close()
  
  	if !rebuild {
  		rendered, err := ts.IsRendered(id)
  		if err != nil {
  			return "", "", errwrap.Wrap(errors.New("cannot determine if tree is already rendered"), err)
  		}
  		if rendered {
  			return id, "", nil
  		}
  	}
  	// Firstly remove a possible partial treestore if existing.
  	// This is needed as a previous ACI removal operation could have failed
  	// cleaning the tree store leaving some stale files.
  	if err := ts.remove(id); err != nil {
  		return "", "", err
  	}
  	if hash, err = ts.render(id, key); err != nil {
  		return "", "", err
  	}
  
  	return id, hash, nil
  }
docs: // Render renders a treestore for the given image key if it's not
  // already fully rendered.
  // Users of treestore should call s.Render before using it to ensure
  // that the treestore is completely rendered.
  // Returns the id and hash of the rendered treestore if it is newly rendered,
  // and only the id if it is already rendered.