You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.
According to zookeeper document, if ChildrenWatcher is set on a node, when this node deleted, EventNodeDeleted should be received on the watcher. But this event is only sent to Conn.eventChan.
example code:
package main
import (
"fmt"
"github.com/samuel/go-zookeeper/zk"
"time"
)
func main() {
c, zkChan, err := zk.Connect([]string{"127.0.0.1"}, time.Second) //*10)
if err != nil {
panic(err)
}
children, stat, wCh, err := c.ChildrenW("/foo")
if err != nil {
panic(err)
}
fmt.Printf("%+v %+v\n", children, stat)
for {
select {
case e := <-wCh:
fmt.Printf("get event from watcher: %+v\n", e)
case e := <-zkChan:
fmt.Printf("get event from session: %+v\n", e)
}
}
}
output:
go run watcher.go
[] &{Czxid:25769803778 Mzxid:25769803778 Ctime:1394091427992 Mtime:1394091427992 Version:0 Cversion:0 Aversion:0 EphemeralOwner:0 DataLength:2 NumChildren:0 Pzxid:25769803778}
get event from session: {Type:EventSession State:StateConnecting Path: Err:<nil>}
get event from session: {Type:EventSession State:StateConnected Path: Err:<nil>}
get event from session: {Type:EventSession State:StateHasSession Path: Err:<nil>}
get event from session: {Type:EventNodeDeleted State:StateSyncConnected Path:/foo Err:<nil>}
^Cexit status 2
According to zookeeper document, if ChildrenWatcher is set on a node, when this node deleted, EventNodeDeleted should be received on the watcher. But this event is only sent to Conn.eventChan.
example code:
output:
seems a minor modification is needed on conn.go:
The text was updated successfully, but these errors were encountered: