Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseServiceNV ¶
Types ¶
type BindAddr ¶
net.Addr的增强版(可递增查找可用端口)
func NewBindAddr ¶
addr格式: 0.0.0.0:1000-2000 {Port = 1000, MinPort = 1000, MaxPort = 2000}
type Criteria ¶
type Criteria struct { ServiceCriterias []*ServiceCriteria // contains filtered or unexported fields }
说明: 4个字段, 如果没有内容则不比较, 只有有内容时才比较.
也就是说一个空的Criteria和所有的ServiceInfo都匹配.
func NewCriteria ¶
func NewCriteria() *Criteria
func (*Criteria) AddInstance ¶
func (*Criteria) AddService ¶
func (*Criteria) Matches ¶
func (criteria *Criteria) Matches(si *ServiceInfo) bool
type ServiceCriteria ¶
type ServiceInfo ¶
type ServiceInfo struct { *ServiceKey InstanceUUID string // Instance UUID (标识这个ServiceInfo属于哪个Instance) //Name string // 构造的时候指定 //Version string // 构造的时候指定 Region string // region // 每个ServiceInfo都会有一个Listen的BindAddr Addr *BindAddr // 从配置文件中读取: host, service.port.min, service.port.max // 辅助属性 LastRegisteredTimestamp int64 // 上次上报的时间戳 }
一个Service的标识
func NewServiceInfo ¶
func NewServiceInfo(name, version string) *ServiceInfo
func (*ServiceInfo) Equal ¶
func (si *ServiceInfo) Equal(otherSi *ServiceInfo) bool
func (*ServiceInfo) ServiceUUID ¶
func (si *ServiceInfo) ServiceUUID() string
func (*ServiceInfo) String ¶
func (si *ServiceInfo) String() string
type ServiceKey ¶
func NewServiceKey ¶
func NewServiceKey(name, version string) *ServiceKey
func (*ServiceKey) Equal ¶
func (sk *ServiceKey) Equal(other *ServiceKey) bool
func (*ServiceKey) String ¶
func (sk *ServiceKey) String() string
type ServiceRPCClientHandshake ¶
type ServiceRPCClientHandshake struct {
ClientUUID string
}
[RPC Client -> RPC Server]
type ServiceRPCServerHandshake ¶
type ServiceRPCServerHandshake struct { ServiceName string // Service Name ClientUUID string // RPC Server分配给RPC Client的UUID }
[RPC Server -> RPC Client]
Click to show internal directories.
Click to hide internal directories.