etcdiscovery

package
v0.0.0-...-d843dc6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PutEvent    = "PUT"
	DeleteEvent = "DELETE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoveryCallbacks

type DiscoveryCallbacks struct {
	OnStartedDiscovering func(services []Service)
	OnServiceChanged     func(services []Service, event DiscoveryEvent)
	OnStoppedDiscovering func()
}

type DiscoveryEvent

type DiscoveryEvent struct {
	Type string
	Service
}

type EtcdDiscovery

type EtcdDiscovery struct {
	EtcdDiscoveryConfig
	// contains filtered or unexported fields
}

func New

func New(config EtcdDiscoveryConfig) (*EtcdDiscovery, error)

func (*EtcdDiscovery) Close

func (d *EtcdDiscovery) Close() error

func (*EtcdDiscovery) DrainServices

func (d *EtcdDiscovery) DrainServices(ctx context.Context) error

func (*EtcdDiscovery) ListServices

func (d *EtcdDiscovery) ListServices() []Service

func (*EtcdDiscovery) Register

func (d *EtcdDiscovery) Register(ctx context.Context) error

func (*EtcdDiscovery) UnRegister

func (d *EtcdDiscovery) UnRegister(ctx context.Context) error

func (*EtcdDiscovery) Watch

func (d *EtcdDiscovery) Watch(ctx context.Context) error

type EtcdDiscoveryConfig

type EtcdDiscoveryConfig struct {
	Client     *clientv3.Client
	Prefix     string
	Key        string
	Val        string
	TTLSeconds int

	Callbacks DiscoveryCallbacks
}

type Service

type Service struct {
	Path string
	Name string
	Val  string
}

Jump to

Keyboard shortcuts

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