svchealth

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff struct {
	Add    map[addr.HostSVC][]net.IP
	Remove map[addr.HostSVC][]net.IP
}

Diff keeps track of the differences between two topologies.

func ComputeDiff

func ComputeDiff(prev, next map[addr.HostSVC][]*net.UDPAddr) Diff

ComputeDiff computes the difference between two topologies. Currently, only differences in the control service and SIG service IP addresses are considered.

type Discoverer

type Discoverer interface {
	Discover(ctx context.Context, svc addr.HostSVC) ([]*net.UDPAddr, error)
	Discoverable(svc addr.HostSVC) bool
}

Discoverer discovers healthy service instances of different types.

type DiscovererMap

type DiscovererMap map[addr.HostSVC]interface {
	Discover(ctx context.Context, svc addr.HostSVC) ([]*net.UDPAddr, error)
}

DiscovererMap implements the Discoverer interface and allows registering different health discoverers per service type.

func (DiscovererMap) Discover

func (m DiscovererMap) Discover(ctx context.Context, svc addr.HostSVC) ([]*net.UDPAddr, error)

Discover invokes the appropriate health discoverer.

func (DiscovererMap) Discoverable

func (m DiscovererMap) Discoverable(svc addr.HostSVC) bool

Discoverable indicates whether discovery for the service type is supported.

type StaticDiscoverer

type StaticDiscoverer struct {
	Addrs []*net.UDPAddr
}

StaticDiscoverer returns a static set of instances.

func (StaticDiscoverer) Discover

func (s StaticDiscoverer) Discover(_ context.Context, _ addr.HostSVC) ([]*net.UDPAddr, error)

Discover returns a static set of instances.

type Watcher

type Watcher struct {
	Discoverer Discoverer
	Topology   topology.Topology
	// contains filtered or unexported fields
}

Watcher watches for service changes in the topology.

func (*Watcher) Discover

func (w *Watcher) Discover(ctx context.Context) (Diff, error)

Discover discovers a service health differential update based on the health discoverer. Every service, where healthy discovery fails, falls back to the configured topology. The initial diff is based on the configured topology. It is safe to concurrent access.

Directories

Path Synopsis
Package mock_svchealth is a generated GoMock package.
Package mock_svchealth is a generated GoMock package.

Jump to

Keyboard shortcuts

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