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
Click to show internal directories.
Click to hide internal directories.