@Override public List<String> list(String path) throws IOException { validatePath(path); return zkList(path); }
@Override public void delete(String path, boolean recursive) throws IOException { validatePath(path); zkDelete(path, recursive, null); }
@Override public List<String> list(String path) throws IOException { validatePath(path); return zkList(path); }
@Override public void delete(String path, boolean recursive) throws IOException { validatePath(path); zkDelete(path, recursive, null); }
@Override public boolean exists(String path) throws IOException { validatePath(path); return zkPathExists(path); }
@Override public boolean exists(String path) throws IOException { validatePath(path); return zkPathExists(path); }
@Override public boolean mknode(String path, boolean createParents) throws IOException { validatePath(path); return zkMkPath(path, CreateMode.PERSISTENT, createParents, getClientAcls()); }
@Override public boolean mknode(String path, boolean createParents) throws IOException { validatePath(path); return zkMkPath(path, CreateMode.PERSISTENT, createParents, getClientAcls()); }
@Override public void bind(String path, ServiceRecord record, int flags) throws IOException { Preconditions.checkArgument(record != null, "null record"); validatePath(path); // validate the record before putting it RegistryTypeUtils.validateServiceRecord(path, record); if (LOG.isDebugEnabled()) { LOG.debug("Bound at {} : ServiceRecord = {}", path, record); } CreateMode mode = CreateMode.PERSISTENT; byte[] bytes = serviceRecordMarshal.toBytes(record); zkSet(path, mode, bytes, getClientAcls(), ((flags & BindFlags.OVERWRITE) != 0)); }
@Override public void bind(String path, ServiceRecord record, int flags) throws IOException { Preconditions.checkArgument(record != null, "null record"); validatePath(path); // validate the record before putting it RegistryTypeUtils.validateServiceRecord(path, record); LOG.info("Bound at {} : {}", path, record); CreateMode mode = CreateMode.PERSISTENT; byte[] bytes = serviceRecordMarshal.toBytes(record); zkSet(path, mode, bytes, getClientAcls(), ((flags & BindFlags.OVERWRITE) != 0)); }
@Override public RegistryPathStatus stat(String path) throws IOException { validatePath(path); Stat stat = zkStat(path); String name = RegistryPathUtils.lastPathEntry(path); RegistryPathStatus status = new RegistryPathStatus( name, stat.getCtime(), stat.getDataLength(), stat.getNumChildren()); if (LOG.isDebugEnabled()) { LOG.debug("Stat {} => {}", path, status); } return status; }
@Override public RegistryPathStatus stat(String path) throws IOException { validatePath(path); Stat stat = zkStat(path); String name = RegistryPathUtils.lastPathEntry(path); RegistryPathStatus status = new RegistryPathStatus( name, stat.getCtime(), stat.getDataLength(), stat.getNumChildren()); if (LOG.isDebugEnabled()) { LOG.debug("Stat {} => {}", path, status); } return status; }