registry

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *options)

Option 是etcd注册中心选项.

func Context

func Context(ctx context.Context) Option

Context 与注册中心上下文.

func Namespace

func Namespace(ns string) Option

Namespace 具有注册中心名称空间.

func RegisterTTL

func RegisterTTL(ttl time.Duration) Option

RegisterTTL 与注册中心生存时间.

type Registry

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

Registry 是etcd注册中心.

func New

func New(client *etcd.Client, opts ...Option) (r *Registry)

New 创建etcd注册中心

func (*Registry) Deregister

func (r *Registry) Deregister(ctx context.Context, service *registry.ServiceInstance) error

Deregister 解除注册.

func (*Registry) GetService

func (r *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error)

GetService 根据服务名称返回注册中心中的服务实例.

func (*Registry) Register

func (r *Registry) Register(ctx context.Context, service *registry.ServiceInstance) error

Register 进行注册.

func (*Registry) Watch

func (r *Registry) Watch(ctx context.Context, name string) (registry.Watcher, error)

Watch 根据服务名称创建观察者.

Jump to

Keyboard shortcuts

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