Documentation
¶
Index ¶
Constants ¶
View Source
const ( // API 提供API访问的服务 API = ServiceType("api") // Worker 后台作业服务 Worker = ServiceType("worker") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Register ¶
type Register interface {
Registe(service *ServiceInstance) (<-chan HeatbeatResonse, error)
UnRegiste() error
}
Register 服务注册接口
type ServiceInstance ¶
type ServiceInstance struct {
Region string `json:"region,omitempty"`
InstanceName string `json:"instanceName,omitempty"`
ServiceName string `json:"serviceName,omitempty"`
Type ServiceType `json:"serviceType,omitempty"`
Address string `json:"address,omitempty"`
Version string `json:"version,omitempty"`
GitBranch string `json:"gitBranch,omitempty"`
GitCommit string `json:"gitCommit,omitempty"`
BuildEnv string `json:"buildEnv,omitempty"`
BuildAt string `json:"buildAt,omitempty"`
Online int64 `json:"online,omitempty"` // 毫秒时间戳
Meta map[string]interface{} `json:"meta,omitempty"`
Prefix string `json:"-"`
Interval time.Duration `json:"-"`
TTL int64 `json:"-"`
}
ServiceInstance todo
func (*ServiceInstance) MakeRegistryKey ¶
func (s *ServiceInstance) MakeRegistryKey() string
MakeRegistryKey 构建etcd对应的key
type ServiceType ¶
type ServiceType string
ServiceType 服务类型
func ParseInstanceKey ¶
func ParseInstanceKey(key string) (serviceName, region, instanceName string, serviceType ServiceType, err error)
ParseInstanceKey 解析key中的服务信息
Click to show internal directories.
Click to hide internal directories.