Back to godoc.org

Package zookeeper

v0.3.3
Latest Go to latest

The latest major version is .

Published: Jan 20, 2020 | License: MIT | Module: github.com/bilibili/kratos

Index

Variables

var (

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

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.

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier