etcd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEtcdV3Discovery

func NewEtcdV3Discovery(basePath string, servicePath string, etcdAddrs []string, options *store.Options) (base.Discovery, error)

NewEtcdV3Discovery returns a new EtcdV3Discovery.

func NewEtcdV3Registry

func NewEtcdV3Registry(serviceAddr, path string, etcdAddrs []string, options *store.Options) (base.Registry, error)

NewEtcdV3Registry init etcd v3 registry

Types

type EtcdV3Discovery

type EtcdV3Discovery struct {
	BasePath string

	// -1 means it always retry to watch until zookeeper is ok, 0 means no retry.
	RetriesAfterWatchFailed int
	// contains filtered or unexported fields
}

EtcdV3Discovery is an etcd service discovery. It always returns the registered servers in etcd.

func (*EtcdV3Discovery) Close

func (d *EtcdV3Discovery) Close()

func (*EtcdV3Discovery) GetServices

func (d *EtcdV3Discovery) GetServices() []*base.ServiceInstance

GetServices returns the servers

func (*EtcdV3Discovery) RemoveWatcher

func (d *EtcdV3Discovery) RemoveWatcher(ch chan []*base.ServiceInstance)

func (*EtcdV3Discovery) WatchService

func (d *EtcdV3Discovery) WatchService() <-chan []*base.ServiceInstance

WatchService returns a nil chan.

type EtcdV3Registry

type EtcdV3Registry struct {
	BasePath       string
	ServiceAddress string
	EtcdServers    []string

	Services []string

	UpdateInterval time.Duration
	Expired        time.Duration
	// contains filtered or unexported fields
}

EtcdV3Registry implements etcd registry.

func (*EtcdV3Registry) Register

func (r *EtcdV3Registry) Register(ctx context.Context, serviceInstance *base.ServiceInstance) error

func (*EtcdV3Registry) Unregister

func (r *EtcdV3Registry) Unregister(ctx context.Context, name string) (err error)

Unregister the name service

func (*EtcdV3Registry) UnregisterAllService

func (r *EtcdV3Registry) UnregisterAllService(ctx context.Context) error

UnregisterAllService unregister all services.

Jump to

Keyboard shortcuts

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