etcd

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

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 is a function that configures the service discovery.

func WithLogger

func WithLogger(logger xlog.Logger) Option

WithLogger returns a new Option that sets the logger.

func WithNamespace

func WithNamespace(namespace string) Option

WithNamespace returns a new Option that sets the namespace.

func WithTTL

func WithTTL(ttl time.Duration) Option

WithTTL returns a new Option that sets the ttl.

type ServiceDiscovery

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

ServiceDiscovery is a etcd service discovery.

func New

func New(ctx context.Context, client *clientv3.Client, optFns ...Option) *ServiceDiscovery

New creates a new etcd service discovery.

func (*ServiceDiscovery) Deregister

func (s *ServiceDiscovery) Deregister(ctx context.Context, service *sd.ServiceInfo) error

Deregister deregisters a service.

func (*ServiceDiscovery) GetService

func (s *ServiceDiscovery) GetService(ctx context.Context, serviceName string) ([]*sd.ServiceInfo, error)

GetService gets a service.

func (*ServiceDiscovery) NewWatcher

func (s *ServiceDiscovery) NewWatcher(ctx context.Context, serviceName string) (sd.Watcher, error)

NewWatcher creates a new watcher.

func (*ServiceDiscovery) Register

func (s *ServiceDiscovery) Register(ctx context.Context, service *sd.ServiceInfo) error

Register registers a service.

Jump to

Keyboard shortcuts

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