servicediscovery

package
v0.0.0-...-41dda67 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitServerInfo

func InitServerInfo(serverID, serverType, serviceAddr string)

func Set

func Set(sd ServiceDiscovery)

Types

type ServerInfo

type ServerInfo struct {
	ID             string   `json:"id,omitempty"`
	Type           string   `json:"type,omitempty"`
	Addr           string   `json:"addr,omitempty"`
	ClientHandlers []string `json:"client_handlers,omitempty"`
	ServerHandlers []string `json:"server_handlers,omitempty"`
}

func GetServerInfo

func GetServerInfo() *ServerInfo

type ServerWatcher

type ServerWatcher interface {
	OnAddServer(serverInfo *ServerInfo)
	OnRemoveServer(serverInfo *ServerInfo)
}

type ServiceDiscovery

type ServiceDiscovery interface {
	Start() error
	GetRandomServer(serverType string) (*ServerInfo, bool)
	GetServer(serverID string) (*ServerInfo, bool)
	AddServerWatcher(watcher ServerWatcher)
	Close() error
}

func Get

func Get() ServiceDiscovery

func NewEtcd

func NewEtcd(addr string, frameDieChan chan error) ServiceDiscovery

Jump to

Keyboard shortcuts

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