public ZooKeeperResult <string[]> GetChildren(string path, IWatcher watcher = null) { LogGetChildren(path, watcher); return(ExecuteOperation( path, () => { var builder = Curator.getChildren(); if (watcher != null) { builder = (GetChildrenBuilder)builder.usingWatcher(WrapWatcher(watcher)); } return ((List)builder.forPath(path)).toArray().Select(o => o.ToString()).ToArray(); })); }
public ZooKeeperResult <Tuple <string[], Stat> > GetChildrenWithStat(string path, IWatcher watcher = null) { LogGetChildren(path, watcher); return(ExecuteOperation( path, () => { var builder = Curator.getChildren(); if (watcher != null) { builder = (GetChildrenBuilder)builder.usingWatcher(WrapWatcher(watcher)); } var stat = new org.apache.zookeeper.data.Stat(); var pathable = (WatchPathable)builder.storingStatIn(stat); var children = ((List)pathable.forPath(path)).toArray().Select(o => o.ToString()).ToArray(); return Tuple.Create(children, new Stat(stat)); })); }