Esempio n. 1
0
        public void testRoundTrip()
        {
            MultiTransactionRecord request = new MultiTransactionRecord();

            request.add(Op.check("check", 1));
            request.add(Op.create("create", "create data".getBytes(), ZooDefs.Ids.CREATOR_ALL_ACL, (int)ZooDefs.Perms.ALL));
            request.add(Op.delete("delete", 17));
            request.add(Op.setData("setData", "set data".getBytes(), 19));

            MultiTransactionRecord decodedRequest = codeDecode(request);

            Assert.assertEquals(request, decodedRequest);
        }
Esempio n. 2
0
 /// <summary>
 ///     Constructs an version check operation.  Arguments are as for the ZooKeeper.setData method except that
 ///     no data is provided since no update is intended.  The purpose for this is to allow read-modify-write
 ///     operations that apply to multiple znodes, but where some of the znodes are involved only in the read,
 ///     not the write.  A similar effect could be achieved by writing the same data back, but that leads to
 ///     way more version updates than are necessary and more writing in general.
 /// </summary>
 /// <param name="path">
 ///     the path of the node
 /// </param>
 /// <param name="version">
 ///     the expected matching version
 /// </param>
 public Transaction check(string path, int version)
 {
     ops.Add(Op.check(path, version));
     return(this);
 }