registry

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

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