discovery

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("no service addresses found")

ErrNotFound is returned when no service addresses are found.

Functions

func GenerateInstanceID

func GenerateInstanceID(serviceName string) string

GenerateInstanceID generates a pseudo-random service instance identifier, using a service name suffixed by dash and a random number.

Types

type Registry

type Registry interface {
	// Register creates a service instance record in the registry.
	Register(ctx context.Context, instanceID string, serviceName string, hostPort string) error

	// Deregister removes a service insttance record from the registry.
	Deregister(ctx context.Context, instanceID string, serviceName string) error

	// ServiceAddresses returns the list of addresses of active instances of the given service.
	ServiceAddresses(ctx context.Context, serviceID string) ([]string, error)

	// ReportHealthyState is a push mechanism for reporting healthy sta	te to the registry.
	ReportHealthyState(instanceID string, serviceName string) error
}

Registry defines a service registry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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