// Version returns the number of changes to the data of the node.
-func (stat *Stat) Version() int32 {
- return int32(stat.c.version)
+func (stat *Stat) Version() int {
+ return int(stat.c.version)
}
// CVersion returns the number of changes to the children of the node.
// This only changes when children are created or removed.
-func (stat *Stat) CVersion() int32 {
- return int32(stat.c.cversion)
+func (stat *Stat) CVersion() int {
+ return int(stat.c.cversion)
}
// AVersion returns the number of changes to the ACL of the node.
-func (stat *Stat) AVersion() int32 {
- return int32(stat.c.aversion)
+func (stat *Stat) AVersion() int {
+ return int(stat.c.aversion)
}
// If the node is an ephemeral node, EphemeralOwner returns the session id
@@ -353,13 +353,13 @@
}
// DataLength returns the length of the data in the node in bytes.
-func (stat *Stat) DataLength() int32 {
- return int32(stat.c.dataLength)
+func (stat *Stat) DataLength() int {
+ return int(stat.c.dataLength)
}
// NumChildren returns the number of children of the node.
-func (stat *Stat) NumChildren() int32 {
- return int32(stat.c.numChildren)
+func (stat *Stat) NumChildren() int {
+ return int(stat.c.numChildren)
}
// Pzxid returns the Pzxid of the node, whatever that is.
@@ -657,7 +657,7 @@
//
// It is an error to attempt to set the data of a non-existing node with
// this function. In these cases, use Create instead.
-func (conn *Conn) Set(path, value string, version int32) (stat *Stat, err
error) {
+func (conn *Conn) Set(path, value string, version int) (stat *Stat, err
error) {
cpath := C.CString(path)
cvalue := C.CString(value)
@@ -677,7 +677,7 @@
// Delete removes the node at path. If version is not -1, the operation
// will only succeed if the node is still at this version when the
// node is deleted as an atomic operation.
-func (conn *Conn) Delete(path string, version int32) (err error) {
+func (conn *Conn) Delete(path string, version int) (err error) {
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
rc, cerr := C.zoo_delete(conn.handle, cpath, C.int(version))
@@ -732,7 +732,7 @@
}
// SetACL changes the access control list for path.
-func (conn *Conn) SetACL(path string, aclv []ACL, version int32) error {
+func (conn *Conn) SetACL(path string, aclv []ACL, version int) error {
// The ordering is most likely unstable, so this test must be fixed.
c.Assert(children, Equals, []string{"test1", "zookeeper"})
@@ -432,7 +432,7 @@
stat, watch, err = conn.ExistsW("/test")
c.Assert(err, IsNil)
c.Assert(stat, NotNil)
- c.Assert(stat.NumChildren(), Equals, int32(0))
+ c.Assert(stat.NumChildren(), Equals, 0)
Reviewers: mp+93252_ code.launchpad. net,
Message:
Please take a look.
Description:
https:/ /code.launchpad .net/~niemeyer/ gozk/int32- to-int/ +merge/ 93252
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/5675059/
Affected files:
M retry_test.go
M zk.go
M zk_test.go
Index: retry_test.go stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0)
=== <email address hidden> >
<email address hidden>
=== modified file 'retry_test.go'
--- retry_test.go 2011-11-29 17:44:18 +0000
+++ retry_test.go 2012-02-15 17:18:34 +0000
@@ -20,7 +20,7 @@
data, stat, err := conn.Get("/test")
c.Assert(err, IsNil)
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
c.Assert(data, Equals, "new")
acl, _, err := conn.ACL("/test") stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0) stat.Version( ), Equals, int32(1)) stat.Version( ), Equals, 1)
@@ -38,7 +38,7 @@
func(data string, stat *zk.Stat) (string, error) {
c.Assert(data, Equals, "old")
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
return "brand new", nil
})
c.Assert(err, IsNil)
@@ -46,7 +46,7 @@
data, stat, err := conn.Get("/test")
c.Assert(err, IsNil)
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
c.Assert(data, Equals, "brand new")
// ACL was unchanged by RetryChange(). stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0) stat.Version( ), Equals, int32(0)) // Unchanged! stat.Version( ), Equals, 0) // Unchanged!
@@ -65,7 +65,7 @@
func(data string, stat *zk.Stat) (string, error) {
c.Assert(data, Equals, "old")
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
return "old", nil
})
c.Assert(err, IsNil)
@@ -73,7 +73,7 @@
data, stat, err := conn.Get("/test")
c.Assert(err, IsNil)
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
c.Assert(data, Equals, "old")
}
@@ -90,7 +90,7 @@ stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0) Fatal(" Unexpected node data: " + data) stat.Version( ), Equals, int32(1)) stat.Version( ), Equals, 1)
return "<none> => conflict", nil
case "conflict":
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
return "conflict => new", nil
default:
c.
@@ -105,7 +105,7 @@
c.Assert(err, IsNil)
c.Assert(data, Equals, "conflict => new")
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
}
func (s *S) TestRetryChange ConflictOnSetDu eToChange( c *C) { stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0) stat.Version( ), Equals, int32(1)) stat.Version( ), Equals, 1) Fatal(" Unexpected node data: " + data) stat.Version( ), Equals, int32(2)) stat.Version( ), Equals, 2)
@@ -118,13 +118,13 @@
switch data {
case "old":
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
_, err := conn.Set("/test", "conflict", 0)
c.Assert(err, IsNil)
return "old => new", nil
case "conflict":
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
return "conflict => new", nil
default:
c.
@@ -139,7 +139,7 @@
c.Assert(err, IsNil)
c.Assert(data, Equals, "conflict => new")
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
}
func (s *S) TestRetryChange ConflictOnSetDu eToDelete( c *C) { stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0) "/test" , 0) stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0)
@@ -152,7 +152,7 @@
switch data {
case "old":
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
err := conn.Delete(
c.Assert(err, IsNil)
return "old => <deleted>", nil
@@ -172,7 +172,7 @@
c.Assert(err, IsNil)
c.Assert(data, Equals, "<deleted> => new")
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
// Should be the new ACL. "/test" ) stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0)
acl, _, err := conn.ACL("/test")
@@ -214,7 +214,7 @@
stat, err := conn.Exists(
c.Assert(err, IsNil)
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
c.Assert(called, Equals, false) "/test" ) stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0)
}
@@ -237,7 +237,7 @@
stat, err := conn.Exists(
c.Assert(err, IsNil)
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
c.Assert(called, Equals, true)
}
Index: zk.go
=== <email address hidden> >
<email address hidden>
=== modified file 'zk.go'
--- zk.go 2012-02-13 14:47:46 +0000
+++ zk.go 2012-02-15 17:18:34 +0000
@@ -331,19 +331,19 @@
}
// Version returns the number of changes to the data of the node. c.version)
-func (stat *Stat) Version() int32 {
- return int32(stat.
+func (stat *Stat) Version() int {
+ return int(stat.c.version)
}
// CVersion returns the number of changes to the children of the node. c.cversion) c.cversion)
// This only changes when children are created or removed.
-func (stat *Stat) CVersion() int32 {
- return int32(stat.
+func (stat *Stat) CVersion() int {
+ return int(stat.
}
// AVersion returns the number of changes to the ACL of the node. c.aversion) c.aversion)
-func (stat *Stat) AVersion() int32 {
- return int32(stat.
+func (stat *Stat) AVersion() int {
+ return int(stat.
}
// If the node is an ephemeral node, EphemeralOwner returns the session id
@@ -353,13 +353,13 @@
}
// DataLength returns the length of the data in the node in bytes. c.dataLength) c.dataLength)
-func (stat *Stat) DataLength() int32 {
- return int32(stat.
+func (stat *Stat) DataLength() int {
+ return int(stat.
}
// NumChildren returns the number of children of the node. c.numChildren) c.numChildren)
-func (stat *Stat) NumChildren() int32 {
- return int32(stat.
+func (stat *Stat) NumChildren() int {
+ return int(stat.
}
// Pzxid returns the Pzxid of the node, whatever that is.
@@ -657,7 +657,7 @@
//
// It is an error to attempt to set the data of a non-existing node with
// this function. In these cases, use Create instead.
-func (conn *Conn) Set(path, value string, version int32) (stat *Stat, err
error) {
+func (conn *Conn) Set(path, value string, version int) (stat *Stat, err
error) {
cpath := C.CString(path) unsafe. Pointer( cpath)) conn.handle, cpath, C.int(version))
cvalue := C.CString(value)
@@ -677,7 +677,7 @@
// Delete removes the node at path. If version is not -1, the operation
// will only succeed if the node is still at this version when the
// node is deleted as an atomic operation.
-func (conn *Conn) Delete(path string, version int32) (err error) {
+func (conn *Conn) Delete(path string, version int) (err error) {
cpath := C.CString(path)
defer C.free(
rc, cerr := C.zoo_delete(
@@ -732,7 +732,7 @@
}
// SetACL changes the access control list for path.
-func (conn *Conn) SetACL(path string, aclv []ACL, version int32) error {
+func (conn *Conn) SetACL(path string, aclv []ACL, version int) error {
cpath := C.CString(path) unsafe. Pointer( cpath))
defer C.free(
Index: zk_test.go stat.Mzxid( ), Equals, int64(0)) stat.CTime( ), Equals, time.Unix(0, 0)) stat.MTime( ), Equals, time.Unix(0, 0)) stat.Version( ), Equals, int32(0)) stat.CVersion( ), Equals, int32(0)) stat.AVersion( ), Equals, int32(0)) stat.Version( ), Equals, 0) stat.CVersion( ), Equals, 0) stat.AVersion( ), Equals, 0) stat.EphemeralO wner(), Equals, int64(0)) stat.DataLength (), Equals, int32(0)) stat.NumChildre n(), Equals, int32(1)) stat.DataLength (), Equals, 0) stat.NumChildre n(), Equals, 1) stat.Pzxid( ), Equals, int64(0))
=== <email address hidden> >
<email address hidden>
=== modified file 'zk_test.go'
--- zk_test.go 2012-02-13 14:47:46 +0000
+++ zk_test.go 2012-02-15 17:18:34 +0000
@@ -142,12 +142,12 @@
c.Assert(
c.Assert(
c.Assert(
- c.Assert(
- c.Assert(
- c.Assert(
+ c.Assert(
+ c.Assert(
+ c.Assert(
c.Assert(
- c.Assert(
- c.Assert(
+ c.Assert(
+ c.Assert(
c.Assert(
}
@@ -201,7 +201,7 @@ stat.Version( ), Equals, int32(1)) stat.Version( ), Equals, 1) ween(c, "mtime", stat.MTime(), start, time.Now())
start = time.Now()
stat, err = conn.Set("/test", "bababum", -1) // Any version.
c.Assert(err, IsNil)
- c.Assert(
+ c.Assert(
checkTimeBet
data, _, err := conn.Get("/test") stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0)
@@ -222,7 +222,7 @@
data, stat, watch, err := conn.GetW("/test")
c.Assert(err, IsNil)
c.Assert(data, Equals, "one")
- c.Assert(
+ c.Assert(
select { children, Equals, []string{ "zookeeper" }) stat.NumChildre n(), Equals, int32(1)) stat.NumChildre n(), Equals, 1)
case <-watch:
@@ -313,7 +313,7 @@
children, stat, err := conn.Children("/")
c.Assert(err, IsNil)
c.Assert(
- c.Assert(
+ c.Assert(
children, stat, err = conn.Children( "/non-existent" ) children, Equals, []string{ "zookeeper" }) stat.NumChildre n(), Equals, int32(1)) stat.NumChildre n(), Equals, 1)
c.Assert(err, Equals, zk.ZNONODE)
@@ -331,7 +331,7 @@
children, stat, watch, err := conn.ChildrenW("/")
c.Assert(err, IsNil)
c.Assert(
- c.Assert(
+ c.Assert(
select {
case <-watch:
@@ -352,7 +352,7 @@
children, stat, watch, err = conn.ChildrenW("/") stat.NumChildre n(), Equals, int32(2)) stat.NumChildre n(), Equals, 2)
c.Assert(err, IsNil)
- c.Assert(
+ c.Assert(
// The ordering is most likely unstable, so this test must be fixed. children, Equals, []string{"test1", "zookeeper"}) "/test" ) stat.NumChildre n(), Equals, int32(0)) stat.NumChildre n(), Equals, 0)
c.Assert(
@@ -432,7 +432,7 @@
stat, watch, err = conn.ExistsW(
c.Assert(err, IsNil)
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
c.Check( zk.CountPending Watches( ), Equals, 2) zk.PERM_ ALL)) stat.Version( ), Equals, int32(0)) stat.Version( ), Equals, 0)
}
@@ -513,7 +513,7 @@
c.Assert(err, IsNil)
c.Assert(acl, Equals, zk.WorldACL(
c.Assert(stat, NotNil)
- c.Assert(
+ c.Assert(
acl, stat, err = conn.ACL( "/non-existent" )
c.Assert(err, NotNil)