Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HeartbeatInfo ¶
type InstanceManager ¶
type InstanceManager struct {
// contains filtered or unexported fields
}
The instance of current micro-service, nil if not registered
func (*InstanceManager) FetchInstanceInfo ¶
func (InstanceManager *InstanceManager) FetchInstanceInfo()
func (*InstanceManager) Register ¶
func (InstanceManager *InstanceManager) Register(service *MicroService, remoteAddr string, heartbeatDuration time.Duration)
func (*InstanceManager) Unregister ¶
func (InstanceManager *InstanceManager) Unregister()
unregister service when exit
type MicroService ¶
type MicroService struct { InstanceId GUID `json:"instance_id"` RegisterTime time.Time `json:"register_time"` LastHeartbeat time.Time `json:"last_heartbeat"` Status ServiceStatus `json:"status"` Address string `json:"address"` Port uint `json:"port"` ServiceName string `json:"service_name"` Weight uint `json:"weight"` CPUUse uint `json:"cpu_use"` MemoryTotal uint `json:"memory_total"` MemoryUsed uint `json:"memory_used"` }
func NewMicroService ¶
func NewMicroService(serviceName string, port uint) *MicroService
func NewWeightedMicroService ¶
func NewWeightedMicroService(serviceName string, port uint, serviceWeigh uint) *MicroService
type RegisterRequest ¶
type RegisterServer ¶
type RegisteredInfo ¶
type RegisteredInfo struct { InstanceId GUID `json:"instance_id"` RegisterTime time.Time `json:"register_time"` Status ServiceStatus `json:"status"` }
type RestClient ¶
RestClient is the recommended approach to do rest request in server
func NewRestClient ¶
func NewRestClient(timeout time.Duration, service *MicroService) *RestClient
type ServiceInfo ¶
type ServiceInstances ¶
type ServiceInstances struct { Instance map[string][]MicroService `json:"instance"` Version uint64 `json:"version"` }
Click to show internal directories.
Click to hide internal directories.