コード例 #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());
        }
コード例 #2
0
        public override async Task <ExistsResult> Execute(org.apache.zookeeper.ZooKeeper client)
        {
            var result = await client.existsAsync(Request.Path, wrapper.Wrap(Request.Watcher, Request.IgnoreWatchersCache)).ConfigureAwait(false);

            return(ExistsResult.Successful(Request.Path, result.ToNodeStat()));
        }