discovery

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAlreadyInitialized is used when attempting to re-initialize the discovery provider
	ErrAlreadyInitialized = errors.New("provider already initialized")
	// ErrNotInitialized is used when the provider is not initialized
	ErrNotInitialized = errors.New("provider not initialized")
	// ErrAlreadyRegistered is used when attempting to re-register the provider
	ErrAlreadyRegistered = errors.New("provider already registered")
)

Functions

This section is empty.

Types

type Config added in v0.3.0

type Config map[string]any

Config represents the meta information to pass to the discovery engine

func NewConfig added in v0.3.0

func NewConfig() Config

NewConfig initializes meta

func (Config) GetBool added in v0.3.0

func (m Config) GetBool(key string) (*bool, error)

GetBool returns the int value of a given key which value is a boolean If the key value is not a boolean then an error is return

func (Config) GetInt added in v0.3.0

func (m Config) GetInt(key string) (int, error)

GetInt returns the int value of a given key which value is an integer If the key value is not an integer then an error is return

func (Config) GetMapString added in v0.3.0

func (m Config) GetMapString(key string) (map[string]string, error)

GetMapString returns the map of string value of a given key which value is a map of string Map of string means that the map key value pair are both string

func (Config) GetString added in v0.3.0

func (m Config) GetString(key string) (string, error)

GetString returns the string value of a given key which value is a string If the key value is not a string then an error is return

type Provider added in v0.3.0

type Provider interface {
	// ID returns the discovery name
	ID() string
	// Initialize initializes the plugin: registers some internal data structures, clients etc.
	Initialize() error
	// Register registers this node to a service discovery directory.
	Register() error
	// Deregister removes this node from a service discovery directory.
	Deregister() error
	// SetConfig registers the underlying discovery options
	SetConfig(config Config) error
	// DiscoverPeers returns a list of known nodes.
	DiscoverPeers() ([]string, error)
}

Provider helps discover other running actor system in a cloud environment

type ServiceDiscovery added in v0.3.0

type ServiceDiscovery struct {
	// contains filtered or unexported fields
}

ServiceDiscovery defines the cluster service discovery

func NewServiceDiscovery added in v0.3.0

func NewServiceDiscovery(provider Provider, config Config) *ServiceDiscovery

NewServiceDiscovery creates an instance of ServiceDiscovery

func (ServiceDiscovery) Config added in v0.3.0

func (s ServiceDiscovery) Config() Config

Config returns the service discovery config

func (ServiceDiscovery) Provider added in v0.3.0

func (s ServiceDiscovery) Provider() Provider

Provider returns the service discovery provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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