registry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

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

func (*Component) Close

func (reg *Component) Close() error

Close ...

func (*Component) ListServices

func (reg *Component) ListServices(ctx context.Context, t eregistry.Target) (services []*server.ServiceInfo, err error)

ListServices list service registered in registry with name `name`

func (*Component) RegisterService

func (reg *Component) RegisterService(ctx context.Context, info *server.ServiceInfo) error

RegisterService register service to registry

func (*Component) SyncServices

func (*Component) UnregisterService

func (reg *Component) UnregisterService(ctx context.Context, info *server.ServiceInfo) error

UnregisterService unregister service from registry

func (*Component) WatchServices

func (reg *Component) WatchServices(ctx context.Context, t eregistry.Target) (chan eregistry.Endpoints, error)

WatchServices watch service change event, then return address list

type Config

type Config struct {
	Scheme       string        // 协议
	Prefix       string        // 注册前缀
	ReadTimeout  time.Duration // 读超时
	ServiceTTL   time.Duration // 服务续期
	OnFailHandle string        // 错误后处理手段,panic,error
}

Config Registry配置

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

type Container

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

func DefaultContainer

func DefaultContainer() *Container

func Load

func Load(key string) *Container

func (*Container) Build

func (c *Container) Build(options ...Option) *Component

Build ...

type Option

type Option func(c *Container)

func WithClientEtcd

func WithClientEtcd(etcdClient *eetcd.Component) Option

Jump to

Keyboard shortcuts

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