Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
Config represents the meta information to pass to the discovery engine
func (Config) GetBool ¶ added in v0.3.0
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
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
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
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 (Node) ClusterAddress ¶ added in v1.1.0
ClusterAddress returns address the node's peers will use to connect to
func (Node) GossipAddress ¶ added in v1.1.0
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