etcd3

package
v0.0.0-...-e41513e Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 11 Imported by: 4

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResolver

func NewResolver(registryDir, serviceName string, cfg etcd3.Config) naming.Resolver

Types

type EtcdReigistry

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

func NewRegistry

func NewRegistry(option Option) (*EtcdReigistry, error)

func (*EtcdReigistry) Deregister

func (e *EtcdReigistry) Deregister() error

func (*EtcdReigistry) Register

func (e *EtcdReigistry) Register() error

type EtcdResolver

type EtcdResolver struct {
	Config      etcd3.Config
	RegistryDir string
	ServiceName string
}

EtcdResolver is an implementation of grpc.naming.Resolver

func (*EtcdResolver) Resolve

func (er *EtcdResolver) Resolve(target string) (naming.Watcher, error)

Resolve to resolve the service from etcd

type EtcdWatcher

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

EtcdWatcher is the implementation of grpc.naming.Watcher

func (*EtcdWatcher) Close

func (w *EtcdWatcher) Close()

func (*EtcdWatcher) Next

func (w *EtcdWatcher) Next() ([]*naming.Update, error)

type NodeData

type NodeData struct {
	Addr     string
	Metadata map[string]string
}

type Option

type Option struct {
	EtcdConfig  etcd3.Config
	RegistryDir string
	ServiceName string
	NodeID      string
	NData       NodeData
	Ttl         time.Duration
}

Jump to

Keyboard shortcuts

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