kratos: github.com/bilibili/kratos/pkg/naming/zookeeper Index | Files

package zookeeper

import "github.com/bilibili/kratos/pkg/naming/zookeeper"

Index

Package Files

zookeeper.go

Variables

var (

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

func Build Uses

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

Build register resolver into default zookeeper.

func Builder Uses

func Builder(c *Config) naming.Builder

Builder return default zookeeper resolver builder.

type Config Uses

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

Config is zookeeper config.

type Resolve Uses

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

Resolve zookeeper resolver.

func (*Resolve) Close Uses

func (r *Resolve) Close() error

Close close resolver.

func (*Resolve) Fetch Uses

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

Fetch fetch resolver instance.

func (*Resolve) Watch Uses

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

Watch watch instance.

type Zookeeper Uses

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

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

func New Uses

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

New is new a zookeeper builder.

func (*Zookeeper) Build Uses

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

Build zookeeper resovler builder.

func (*Zookeeper) Close Uses

func (z *Zookeeper) Close() error

Close stop all running process including zk fetch and register.

func (*Zookeeper) Register Uses

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

Register is register instance.

func (*Zookeeper) Scheme Uses

func (z *Zookeeper) Scheme() string

Scheme return zookeeper's scheme.

Package zookeeper imports 14 packages (graph). Updated 2020-08-09. Refresh now. Tools for package owners.