zookeeper

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrDuplication is a register duplication err
	ErrDuplication = errors.New("zookeeper: instance duplicate registration")
)

Functions

func Build

func Build(c *Config, id string) naming.Resolver

Build register resolver into default zookeeper.

func Builder

func Builder(c *Config) naming.Builder

Builder return default zookeeper resolver builder.

Types

type Config

type Config struct {
	Root      string         `json:"root"`
	Endpoints []string       `json:"endpoints"`
	Timeout   xtime.Duration `json:"timeout"`
}

Config is zookeeper config.

type Resolve

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

Resolve zookeeper resolver.

func (*Resolve) Close

func (r *Resolve) Close() error

Close close resolver.

func (*Resolve) Fetch

func (r *Resolve) Fetch(ctx context.Context) (ins *naming.InstancesInfo, ok bool)

Fetch fetch resolver instance.

func (*Resolve) Watch

func (r *Resolve) Watch() <-chan struct{}

Watch watch instance.

type Zookeeper

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

Zookeeper is a zookeeper client Builder. path: /{root}/{appid}/{ip} -> json(instance)

func New

func New(c *Config) (zkb *Zookeeper, err error)

New is new a zookeeper builder.

func (*Zookeeper) Build

func (z *Zookeeper) Build(appid string, options ...naming.BuildOpt) naming.Resolver

Build zookeeper resovler builder.

func (*Zookeeper) Close

func (z *Zookeeper) Close() error

Close stop all running process including zk fetch and register.

func (*Zookeeper) Register

func (z *Zookeeper) Register(ctx context.Context, ins *naming.Instance) (cancelFunc context.CancelFunc, err error)

Register is register instance.

func (*Zookeeper) Scheme

func (z *Zookeeper) Scheme() string

Scheme return zookeeper's scheme.

Jump to

Keyboard shortcuts

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