discovery

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 7 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")
	// ErrNotRegistered is used when attempting to de-register the provider
	ErrNotRegistered = errors.New("provider is not 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 Node

type Node struct {
	// Name specifies the discovered node's Name
	Name string
	// Host specifies the discovered node's Host
	Host string
	// GossipPort
	GossipPort int
	// ClusterPort
	ClusterPort int
	// RemotingPort
	RemotingPort int
}

Node represents a discovered Node

func HostNode added in v1.1.0

func HostNode() (*Node, error)

HostNode returns the Node where the discovery provider is running

func (Node) ClusterAddress added in v1.1.0

func (n Node) ClusterAddress() string

ClusterAddress returns address the node's peers will use to connect to

func (Node) GossipAddress added in v1.1.0

func (n Node) GossipAddress() string

GossipAddress returns the node discovery address

type Provider added in v0.3.0

type Provider interface {
	// ID returns the service discovery provider name
	ID() string
	// Initialize initializes the service discovery provider.
	Initialize() error
	// Register registers the service discovery provider.
	Register() error
	// Deregister de-registers the service discovery provider.
	Deregister() error
	// SetConfig registers the underlying discovery options
	SetConfig(config Config) error
	// DiscoverPeers returns a list discovered nodes' addresses.
	DiscoverPeers() ([]string, error)
	// Close closes the provider
	Close() 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