servicediscovery

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDNS

func NewDNS(address string, dnsLookupPeriod time.Duration, notifications Notifications) (services.Service, error)

NewDNS creates a new DNS-based service discovery.

func NewRing

func NewRing(ringClient *ring.Ring, ringCheckPeriod time.Duration, maxUsedInstances int, receiver Notifications) services.Service

Types

type Instance

type Instance struct {
	Address string

	// InUse is true if this instance should be actively used. For example, if a service discovery
	// implementation enforced a max number of instances to be used, this flag will be set to true
	// only on a number of instances up to the configured max.
	InUse bool
}

Instance notified by the service discovery.

func (Instance) Equal

func (i Instance) Equal(other Instance) bool

type Notifications

type Notifications interface {
	// InstanceAdded is called each time a new instance has been discovered.
	InstanceAdded(instance Instance)

	// InstanceRemoved is called each time an instance that was previously notified by AddressAdded()
	// is no longer available.
	InstanceRemoved(instance Instance)

	// InstanceChanged is called each time an instance that was previously notified by AddressAdded()
	// has changed its InUse value.
	InstanceChanged(instance Instance)
}

Notifications about address resolution. All notifications are sent on the same goroutine.

Jump to

Keyboard shortcuts

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