Documentation
¶
Index ¶
- Constants
- type AbstractDiscoveryClient
- func (c *AbstractDiscoveryClient) GetInstance(serviceId string) *InstanceInfo
- func (c *AbstractDiscoveryClient) GetInstanceById(serviceId string, instanceId string) *InstanceInfo
- func (c *AbstractDiscoveryClient) GetInstances(serviceId string) ([]InstanceInfo, error)
- func (c *AbstractDiscoveryClient) GetService(serviceId string) (*ServiceInfo, error)
- func (c *AbstractDiscoveryClient) GetServices() ([]ServiceInfo, error)
- func (*AbstractDiscoveryClient) SendHeartBeat() (bool, error)
- type Client
- type DataCenterInfo
- type DiscoveryClient
- type InstanceInfo
- type LeaseInfo
- type Metadata
- type PortInfo
- type RegistryClient
- func (s *RegistryClient) Deregister() error
- func (s *RegistryClient) GetInstance(serviceName string) *InstanceInfo
- func (s *RegistryClient) GetInstanceById(serviceName string, instanceId string) *InstanceInfo
- func (s *RegistryClient) GetInstances(serviceName string) []InstanceInfo
- func (s *RegistryClient) GetSerivceEntry(serviceName string) (string, error)
- func (s *RegistryClient) GetService(name string) *ServiceInfo
- func (s *RegistryClient) GetServices() []ServiceInfo
- func (s *RegistryClient) Init()
- func (s *RegistryClient) Register() (bool, error)
- func (s *RegistryClient) Shutdown()
- type ServiceInfo
Constants ¶
View Source
const ( STATUS_UP = "UP" // Ready to receive traffic STATUS_DOWN = "DOWN" // Do not send traffic- healthcheck callback failed STATUS_STARTING = "STARTING" //Just about starting- initializations to be done - do not STATUS_OUT_OF_SERVICE = "OUT_OF_SERVICE" //Intentionally shutdown for traffic STATUS_UNKOWN = "UNKNOWN" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractDiscoveryClient ¶
type AbstractDiscoveryClient struct {
}
func (*AbstractDiscoveryClient) GetInstance ¶
func (c *AbstractDiscoveryClient) GetInstance(serviceId string) *InstanceInfo
func (*AbstractDiscoveryClient) GetInstanceById ¶
func (c *AbstractDiscoveryClient) GetInstanceById(serviceId string, instanceId string) *InstanceInfo
func (*AbstractDiscoveryClient) GetInstances ¶
func (c *AbstractDiscoveryClient) GetInstances(serviceId string) ([]InstanceInfo, error)
func (*AbstractDiscoveryClient) GetService ¶
func (c *AbstractDiscoveryClient) GetService(serviceId string) (*ServiceInfo, error)
func (*AbstractDiscoveryClient) GetServices ¶
func (c *AbstractDiscoveryClient) GetServices() ([]ServiceInfo, error)
func (*AbstractDiscoveryClient) SendHeartBeat ¶
func (*AbstractDiscoveryClient) SendHeartBeat() (bool, error)
type DataCenterInfo ¶
type DiscoveryClient ¶
type DiscoveryClient interface {
Register() (bool, error)
Deregister() error
GetServices() ([]ServiceInfo, error)
GetService(serviceId string) (*ServiceInfo, error)
GetInstances(serviceId string) ([]InstanceInfo, error)
GetInstance(serviceId string) *InstanceInfo
GetInstanceById(serviceId string, instanceId string) *InstanceInfo
SendHeartBeat(instance *InstanceInfo, status string) (bool, error)
}
服务发现
type InstanceInfo ¶
type InstanceInfo struct {
ServiceName string `json:"app,omitempty"`
InstanceId string `json:"instanceId,omitempty"`
HostName string `json:"hostName,omitempty"`
IpAddr string `json:"ipAddr,omitempty"`
Port PortInfo `json:"port,omitempty"`
SecurePort PortInfo `json:"securePort,omitempty"`
Status string `json:"status,omitempty"`
OverriddenStatus string `json:"overriddenStatus,omitempty"`
CountryId int `json:"countryId,omitempty"`
DataCenterInfo DataCenterInfo `json:"dataCenterInfo,omitempty"`
LeaseInfo LeaseInfo `json:"leaseInfo,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
HomePageUrl string `json:"homePageUrl,omitempty"`
StatusPageUrl string `json:"statusPageUrl,omitempty"`
HealthCheckUrl string `json:"healthCheckUrl,omitempty"`
VipAddress string `json:"vipAddress,omitempty"`
SecureVipAddress string `json:"secureVipAddress,omitempty"`
IsCoordinatingDiscoveryServer string `json:"isCoordinatingDiscoveryServer,omitempty"`
LastUpdatedTimestamp string `json:"lastUpdatedTimestamp,omitempty"`
LastDirtyTimestamp string `json:"lastDirtyTimestamp,omitempty"`
ActionType string `json:"actionType,omitempty"`
}
type LeaseInfo ¶
type LeaseInfo struct {
RenewalIntervalInSecs int `json:"renewalIntervalInSecs,omitempty"`
DurationInSecs int `json:"durationInSecs,omitempty"`
RegistrationTimestamp int64 `json:"registrationTimestamp,omitempty"`
LastRenewalTimestamp int64 `json:"lastRenewalTimestamp,omitempty"`
EvictionTimestamp int64 `json:"evictionTimestamp,omitempty"`
ServiceUpTimestamp int64 `json:"serviceUpTimestamp,omitempty"`
}
type PortInfo ¶
type PortInfo struct {
Port int `json:"$,omitempty"`
Enabled interface{} `json:"@enabled,omitempty"`
}
type RegistryClient ¶
type RegistryClient struct {
InstanceInfo
// contains filtered or unexported fields
}
func NewRegistryClient ¶
func NewRegistryClient() *RegistryClient
func (*RegistryClient) Deregister ¶
func (s *RegistryClient) Deregister() error
func (*RegistryClient) GetInstance ¶
func (s *RegistryClient) GetInstance(serviceName string) *InstanceInfo
func (*RegistryClient) GetInstanceById ¶
func (s *RegistryClient) GetInstanceById(serviceName string, instanceId string) *InstanceInfo
func (*RegistryClient) GetInstances ¶
func (s *RegistryClient) GetInstances(serviceName string) []InstanceInfo
func (*RegistryClient) GetSerivceEntry ¶
func (s *RegistryClient) GetSerivceEntry(serviceName string) (string, error)
func (*RegistryClient) GetService ¶
func (s *RegistryClient) GetService(name string) *ServiceInfo
func (*RegistryClient) GetServices ¶
func (s *RegistryClient) GetServices() []ServiceInfo
func (*RegistryClient) Init ¶
func (s *RegistryClient) Init()
func (*RegistryClient) Register ¶
func (s *RegistryClient) Register() (bool, error)
func (*RegistryClient) Shutdown ¶
func (s *RegistryClient) Shutdown()
type ServiceInfo ¶
type ServiceInfo struct {
Name string `json:"name"`
Instances []InstanceInfo `json:"instances"`
}
Click to show internal directories.
Click to hide internal directories.