zconf

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: MIT Imports: 6 Imported by: 0

README

ZConf

Usage

Installation
go get github.com/nenavizhuleto/zconf
In code
import "github.com/nenavizhuleto/zconf"

func main() {
	zc, _ := zconf.New([]string{"localhost:2182"})

    zc.WatchNode("/")
}

Subscribe for changes to ZooKeeper Nodes

c.OnNodeChanged(func(path string) {
    fmt.Println("path", path, "changed")
})

c.OnNodeDataChanged(func(path string, data []byte) {
    fmt.Println("path", path, "data", string(data))
})

c.WatchPath("/")

see examples for more.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultSessionTimeout = time.Second
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func New

func New(servers []string) (*Config, error)

func (*Config) Dump added in v0.0.3

func (c *Config) Dump(path string, value any) error

func (*Config) Get added in v0.1.0

func (c *Config) Get(nodepath string) (node Node, err error)

func (*Config) OnNodeChanged

func (c *Config) OnNodeChanged(callback NodeCallback)

func (*Config) OnNodeDeleted added in v0.0.5

func (c *Config) OnNodeDeleted(callback NodeCallback)

func (*Config) WatchNode

func (c *Config) WatchNode(ctx context.Context, nodepath string) error

func (*Config) WatchPath

func (c *Config) WatchPath(ctx context.Context, path string) error

type Node added in v0.1.0

type Node struct {
	Path string
	Data []byte
	// contains filtered or unexported fields
}

func (*Node) Children added in v0.1.0

func (n *Node) Children() (nodes []Node, err error)

type NodeCallback

type NodeCallback func(path string, data []byte)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL