Example #1
0
        public async Task <List <string> > GetStores()
        {
            var zooKeeper = new org.apache.zookeeper.ZooKeeper(connectionString, 100000, null, true);

            org.apache.zookeeper.ZooKeeper.LogToFile  = false;
            org.apache.zookeeper.ZooKeeper.LogToTrace = true;

            var list = await zooKeeper.getChildrenAsync("/");

            var all = list.Children.Select(x => new { Key = x, Exist = zooKeeper.existsAsync("/" + x + "/features") }).ToArray();
            await Task.WhenAll(all.Select(x => x.Exist));

            return(all.Where(x => x.Exist.Status == TaskStatus.RanToCompletion && x.Exist.Result != null)
                   .Select(x => x.Key)
                   .ToList());
        }
        public override async Task <GetChildrenResult> Execute(org.apache.zookeeper.ZooKeeper client)
        {
            var result = await client.getChildrenAsync(Request.Path, wrapper.Wrap(Request.Watcher, Request.IgnoreWatchersCache)).ConfigureAwait(false);

            return(GetChildrenResult.Successful(Request.Path, result.Children, result.Stat.ToNodeStat()));
        }