Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Global = New()
Global is the global service registry.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { // ServiceName is required. ServiceName string `yaml:"serviceName"` // Scheme is optional if Port is not empty. Scheme string `yaml:"scheme"` // Hostname is optional if HostIP is not empty. Hostname string `yaml:"hostname"` // HostIP is optional if Hostname is not empty. HostIP string `yaml:"hostIP"` // Port is optional if Scheme is not empty Port uint16 `yaml:"port"` // Tags is optional. Tags []string `yaml:"tags"` // Weight is optional. Weight int `yaml:"weight"` }
Server stands for one instance of the server.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service contains the information of all backend servers of one service.
func NewService ¶
NewService creates a Service.
func (*Service) CloseMessage ¶
CloseMessage closes the service.
func (*Service) Closed ¶
func (s *Service) Closed() chan struct{}
Closed returns the notifying channel to post close.
type ServiceRegistry ¶
type ServiceRegistry struct {
// contains filtered or unexported fields
}
ServiceRegistry is the service center containing all drivers.
func (*ServiceRegistry) CloseRegistry ¶
func (sg *ServiceRegistry) CloseRegistry(registryName string)
CloseRegistry deletes the registry with closing its services.
func (*ServiceRegistry) GetService ¶
func (sg *ServiceRegistry) GetService(registryName, serviceName string) (*Service, error)
GetService gets service. NOTICE: If the registryName is empty, and there is one and only one ServiceRegistry, it uses the only one.
func (*ServiceRegistry) ReplaceServers ¶
func (sg *ServiceRegistry) ReplaceServers(registryName string, servers []*Server)
ReplaceServers replaces all servers of the registry.
Click to show internal directories.
Click to hide internal directories.