class ZookeeperClient implements AutoCloseable {

  public byte[] putIfAbsent(final String path, final byte[] data) {
    Preconditions.checkNotNull(path, "path is required");
    Preconditions.checkNotNull(data, "data is required");

    final String target = PathUtils.join(root, path);
    try {
      try {
        curator.create().withMode(mode).forPath(target, data);
        getCache().rebuildNode(target);
        return null;
      } catch (NodeExistsException e) {
        // do nothing
      }
      return curator.getData().forPath(target);
    } catch (final Exception e) {
      throw new DrillRuntimeException("unable to put ", e);
    }
  }

  public  ZookeeperClient(final CuratorFramework curator, final String root, final CreateMode mode);

}