Exemplo n.º 1
0
 private static Task deleteNode(string path)
 {
     return(ZooKeeper.Using(hostPort, CONNECTION_TIMEOUT, NullWatcher.Instance, zk =>
     {
         return ZKUtil.deleteRecursiveAsync(zk, path);
     }));
 }
Exemplo n.º 2
0
        public void testDeleteRecursive()
        {
            ZooKeeper zk = createClient();

            // making sure setdata works on /
            zk.setData("/", "some".getBytes(), -1);
            zk.create("/a", "some".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

            zk.create("/a/b", "some".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

            zk.create("/a/b/v", "some".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

            zk.create("/a/b/v/1", "some".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

            zk.create("/a/c", "some".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

            zk.create("/a/c/v", "some".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

            IList <string> children = zk.getChildren("/a", false);

            Assert.assertEquals("2 children - b & c should be present ", children.Count, 2);
            Assert.assertTrue(children.Contains("b"));
            Assert.assertTrue(children.Contains("c"));

            ZKUtil.deleteRecursiveAsync(zk, "/a").GetAwaiter().GetResult();
            Assert.assertNull(zk.exists("/a", null));
        }
Exemplo n.º 3
0
 internal static Task deleteNode(string path)
 {
     return(ZooKeeper.Using(hostPort, 10000, new NullWatcher(), async zk =>
     {
         await ZKUtil.deleteRecursiveAsync(zk, path);
         await zk.sync("/");
     }));
 }
Exemplo n.º 4
0
        public virtual async Task DisposeAsync()
        {
            await ZKUtil.deleteRecursiveAsync(m_rootZK, m_currentRoot);

            await Task.WhenAll(allClients.Select(c => c.closeAsync()));
        }