Documentation ¶
Index ¶
- Constants
- type DefaultService
- func (d *DefaultService) DialURL() string
- func (d *DefaultService) GetNamespace() string
- func (d *DefaultService) GetProtocol() string
- func (d *DefaultService) PublicAddress() string
- func (d *DefaultService) PublicPort() int
- func (d *DefaultService) ServiceID() string
- func (d *DefaultService) ServiceName() string
- func (d *DefaultService) String() string
- type RegistrationAndDiscovery
- type Service
- type ServiceCallback
Constants ¶
View Source
const ServiceNameAndIDSeparator = "/"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultService ¶
type DefaultService struct { Name string ID string Namespace string Address string Port int Protocol string }
func (*DefaultService) DialURL ¶
func (d *DefaultService) DialURL() string
func (*DefaultService) GetNamespace ¶
func (d *DefaultService) GetNamespace() string
func (*DefaultService) GetProtocol ¶
func (d *DefaultService) GetProtocol() string
func (*DefaultService) PublicAddress ¶
func (d *DefaultService) PublicAddress() string
func (*DefaultService) PublicPort ¶
func (d *DefaultService) PublicPort() int
func (*DefaultService) ServiceID ¶
func (d *DefaultService) ServiceID() string
func (*DefaultService) ServiceName ¶
func (d *DefaultService) ServiceName() string
func (*DefaultService) String ¶
func (d *DefaultService) String() string
type RegistrationAndDiscovery ¶
type RegistrationAndDiscovery interface { Register(ser Service) error //向注册中心注册服务 Deregister(ser Service) error //从注册中心取消注册 Find(serviceName string) ([]Service, error) //根据服务名称从注册中心查找服务 Subscribe(serviceName string, callback ServiceCallback) error //根据服务名订阅服务,订阅后有变动会回调 Unsubscribe(serviceName string) error //取消订阅某类服务 }
type Service ¶
type Service interface { GetNamespace() string ServiceName() string ServiceID() string PublicAddress() string PublicPort() int DialURL() string GetProtocol() string String() string }
func NewService ¶
func ParseServiceFromStr ¶
type ServiceCallback ¶
type ServiceCallback func([]Service)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.