The library to syncronize app nodes by using zookeeper backend.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nodesync/nodesync.go

29 lines
504 B

package sync
import (
"github.com/go-zookeeper/zk"
)
// NodeSync structure
type NodeSync struct {
Zk *zk.Conn
rootPath string
}
// Inside private environment keep everything open
var defaultAcl = zk.WorldACL(zk.PermAll)
// New creates a new nodesync instance
func New(zkconn *zk.Conn, rootPath string) (nodeSync *NodeSync, err error) {
nodeSync = &NodeSync{Zk: zkconn, rootPath: rootPath}
err = nodeSync.createRecursively(rootPath, defaultAcl)
if err != nil {
nodeSync = nil
}
return
}