Documentation ¶
Index ¶
- Constants
- type Handler
- type MsgRegistry
- type Registry
- type RegistryClient
- func (ra *RegistryClient) Connect() (err error)
- func (ra *RegistryClient) Disconnect()
- func (ra *RegistryClient) QuickSubscribe(service string, id string, addr string) (err error)
- func (ra *RegistryClient) Register(serviceName string, id string, addr string) error
- func (ra *RegistryClient) Subscribe() (err error)
- func (ra *RegistryClient) Unsubscribe() error
- type RegistryMsgType
- type RegistryService
- type RegistryServiceList
- type Service
- type ServiceList
- type ServiceListValue
- type ServiceNode
- type SubscribeHandler
Constants ¶
View Source
const DefaultServicePort = 80
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MsgRegistry ¶
type MsgRegistry struct { Type RegistryMsgType // MsgRegisterReq Service string Id string Addr string // MsgServiceListResp PushStart bool PushEnd bool Services ServiceListValue // resp Success bool Error error }
type Registry ¶
type Registry struct { Addr string ServiceList *ServiceList // contains filtered or unexported fields }
func NewRegistry ¶
type RegistryClient ¶
type RegistryClient struct { RegistryAddr string Conn *websocket.Conn ServiceListValue ServiceListValue ServiceListUpdate chan ServiceListValue Quit chan struct{} // contains filtered or unexported fields }
func NewRegistryClient ¶
func NewRegistryClient(addr string) *RegistryClient
func (*RegistryClient) Connect ¶
func (ra *RegistryClient) Connect() (err error)
func (*RegistryClient) Disconnect ¶
func (ra *RegistryClient) Disconnect()
func (*RegistryClient) QuickSubscribe ¶
func (ra *RegistryClient) QuickSubscribe(service string, id string, addr string) (err error)
func (*RegistryClient) Register ¶
func (ra *RegistryClient) Register(serviceName string, id string, addr string) error
func (*RegistryClient) Subscribe ¶
func (ra *RegistryClient) Subscribe() (err error)
func (*RegistryClient) Unsubscribe ¶
func (ra *RegistryClient) Unsubscribe() error
type RegistryMsgType ¶
type RegistryMsgType int
const ( MsgRegisterReq RegistryMsgType = iota MsgRegisterResp MsgServicePushReq MsgServicePushCancelReq MsgServicePushResp MsgCloseReq )
type RegistryService ¶
type RegistryServiceList ¶
type RegistryServiceList map[string][]RegistryService
type Service ¶
type Service []*ServiceNode
type ServiceList ¶
type ServiceList struct { Services ServiceListValue OnAddService Handler // contains filtered or unexported fields }
func (*ServiceList) Add ¶
func (sl *ServiceList) Add(name string, node *ServiceNode)
func (*ServiceList) AddByMsg ¶
func (sl *ServiceList) AddByMsg(msg MsgRegistry)
func (*ServiceList) Remove ¶
func (sl *ServiceList) Remove(name string, node *ServiceNode)
func (*ServiceList) RemoveByMsg ¶
func (sl *ServiceList) RemoveByMsg(msg MsgRegistry)
type ServiceListValue ¶
type ServiceNode ¶
type SubscribeHandler ¶
type SubscribeHandler func(list ServiceListValue)
func (*SubscribeHandler) Handle ¶
func (h *SubscribeHandler) Handle(list ServiceListValue)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.