Documentation ¶
Index ¶
- type Entry
- type ServiceDiscovery
- func (sd *ServiceDiscovery) Close()
- func (sd *ServiceDiscovery) DataChange(eventType remoting.Event) bool
- func (sd *ServiceDiscovery) ListenServiceEvent(name string, listener remoting.DataListener)
- func (sd *ServiceDiscovery) ListenServiceInstanceEvent(name, id string, listener remoting.DataListener)
- func (sd *ServiceDiscovery) QueryForInstance(name string, id string) (*ServiceInstance, error)
- func (sd *ServiceDiscovery) QueryForInstances(name string) ([]*ServiceInstance, error)
- func (sd *ServiceDiscovery) QueryForNames() ([]string, error)
- func (sd *ServiceDiscovery) ReRegisterServices()
- func (sd *ServiceDiscovery) RegisterService(instance *ServiceInstance) error
- func (sd *ServiceDiscovery) UnregisterService(instance *ServiceInstance) error
- func (sd *ServiceDiscovery) UpdateService(instance *ServiceInstance) error
- type ServiceInstance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceDiscovery ¶
type ServiceDiscovery struct {
// contains filtered or unexported fields
}
ServiceInstance which define in curator-x-discovery, please refer to https://github.com/apache/curator/blob/master/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscovery.java It's not exactly the same as curator-x-discovery's service discovery
func NewServiceDiscovery ¶
func NewServiceDiscovery(client *gxzookeeper.ZookeeperClient, basePath string) *ServiceDiscovery
NewServiceDiscovery the constructor of service discovery
func (*ServiceDiscovery) Close ¶
func (sd *ServiceDiscovery) Close()
func (*ServiceDiscovery) DataChange ¶
func (sd *ServiceDiscovery) DataChange(eventType remoting.Event) bool
DataChange implement DataListener's DataChange function
func (*ServiceDiscovery) ListenServiceEvent ¶
func (sd *ServiceDiscovery) ListenServiceEvent(name string, listener remoting.DataListener)
ListenServiceEvent add a listener in a service
func (*ServiceDiscovery) ListenServiceInstanceEvent ¶
func (sd *ServiceDiscovery) ListenServiceInstanceEvent(name, id string, listener remoting.DataListener)
ListenServiceEvent add a listener in a instance
func (*ServiceDiscovery) QueryForInstance ¶
func (sd *ServiceDiscovery) QueryForInstance(name string, id string) (*ServiceInstance, error)
QueryForInstance query instances in zookeeper by name and id
func (*ServiceDiscovery) QueryForInstances ¶
func (sd *ServiceDiscovery) QueryForInstances(name string) ([]*ServiceInstance, error)
QueryForInstances query instances in zookeeper by name
func (*ServiceDiscovery) QueryForNames ¶
func (sd *ServiceDiscovery) QueryForNames() ([]string, error)
QueryForInstance query all service name in zookeeper
func (*ServiceDiscovery) ReRegisterServices ¶
func (sd *ServiceDiscovery) ReRegisterServices()
ReRegisterServices re-register all cache services to zookeeper
func (*ServiceDiscovery) RegisterService ¶
func (sd *ServiceDiscovery) RegisterService(instance *ServiceInstance) error
RegisterService register service to zookeeper, and ensure cache is consistent with zookeeper
func (*ServiceDiscovery) UnregisterService ¶
func (sd *ServiceDiscovery) UnregisterService(instance *ServiceInstance) error
UnregisterService un-register service in zookeeper and delete service in cache
func (*ServiceDiscovery) UpdateService ¶
func (sd *ServiceDiscovery) UpdateService(instance *ServiceInstance) error
UpdateService update service in zookeeper, and ensure cache is consistent with zookeeper
type ServiceInstance ¶
type ServiceInstance struct { Name string `json:"name,omitempty"` ID string `json:"id,omitempty"` Address string `json:"address,omitempty"` Port int `json:"port,omitempty"` Payload interface{} `json:"payload,omitempty"` RegistrationTimeUTC int64 `json:"registrationTimeUTC,omitempty"` }
ServiceInstance which define in curator-x-discovery, please refer to https://github.com/apache/curator/blob/master/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java