registry

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Services map[string]map[string]*service `mapstructure:"services"`
}

Config configures a registry.

func ParseConfig

func ParseConfig(m map[string]interface{}) (*Config, error)

ParseConfig translates Config file values into a Config struct for consumers.

type Node

type Node interface {
	// Address where the given node is running.
	Address() string

	// metadata is used in order to differentiate services implementations. For instance an AuthProvider Service could
	// have multiple implementations, basic, bearer ..., metadata would be used to select the Service type depending on
	// its implementation.
	Metadata() map[string]string

	// ID returns the node ID.
	ID() string
}

Node defines nodes on a service.

type Registry

type Registry interface {
	// Add registers a Service on the memoryRegistry. Repeated names is allowed, services are distinguished by their metadata.
	Add(Service) error

	// GetService retrieves a Service and all of its nodes by Service name. It returns []*Service because we can have
	// multiple versions of the same Service running alongside each others.
	GetService(string) (Service, error)
}

Registry provides with means for dynamically registering services.

type Service

type Service interface {
	Name() string
	Nodes() []Node
}

Service defines a service.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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