Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RoundRobin = func() Balance { return func(len *uint8, index *uint8) uint8 { result := *index *index++ return result } }
RoundRobin Strategy
Functions ¶
Types ¶
type Balance ¶
Balance is Load Balancing implement. len is Service Count index is Current Location. Index ensures that the position of index and index+1 is always valid in the group.
type EndPoint ¶
type EndPoint struct {
// contains filtered or unexported fields
}
EndPoint is Get Service Infomation Entrance. For Service customer.
func (*EndPoint) GetServiceInfo ¶
func (ep *EndPoint) GetServiceInfo(ctx context.Context, in *proto.ProviderInfo) (*proto.ProviderInfo, error)
GetServiceInfo is get Service Info RPC service
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options is Hub Config Options.
func NewOptions ¶
func NewOptions(conf *configuration.Config) *Options
NewOptions return new Option instance.
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver is Rpc Service Entrance. For Service Provider
func (*Receiver) JoinServiceHub ¶
func (recv *Receiver) JoinServiceHub(ctx context.Context, info *proto.ProviderInfo) (*proto.JoinResult, error)
JoinServiceHub is External registration service info is Service Info result is Whether the service registration is Successful.
func (*Receiver) ReportActive ¶
func (recv *Receiver) ReportActive(ctx context.Context, info *proto.ProviderInfo) (*proto.ReportResult, error)
ReportActive is Receive the heartbeat packet of the service.
type ServiceGroup ¶
type ServiceGroup struct {
// contains filtered or unexported fields
}
ServiceGroup is The Same Service, put in this group.
func NewServiceGroup ¶
func NewServiceGroup(len uint8, bala Balance) *ServiceGroup
NewServiceGroup is Get ServiceGroup Instance.
type ServiceHub ¶
type ServiceHub struct {
// contains filtered or unexported fields
}
ServiceHub .
func (*ServiceHub) Join ¶
func (hub *ServiceHub) Join(serviceName string, service *Address)
Join is Join to the service center
func (*ServiceHub) ServiceInfo ¶
func (hub *ServiceHub) ServiceInfo(name string) *Address
ServiceInfo is a Service Infomation.
type ServiceInstance ¶
type ServiceInstance struct {
// contains filtered or unexported fields
}
ServiceInstance is a basic service Information.
func NewServiceInstance ¶
func NewServiceInstance(group *ServiceGroup, ip string, port string) *ServiceInstance
NewServiceInstance is initializer a new ServiceInstance.