Documentation
¶
Index ¶
Constants ¶
View Source
const ( WeightedRoundRobinRule = "wwr" AddressHash = "addr_hash" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalancedService ¶
type BalancedService struct { Client *discover.RestClient //rest client for rpc Service *discover.MicroService //picked instance // contains filtered or unexported fields }
type Balancer ¶
type Balancer interface { //pick the best instance for a request PickInstance(serviceName string, ctx *common.RequestCtx) *BalancedService //notify the balancer good call or a network problem NotifyEffect(service *BalancedService, ok bool) //refresh balancer's instance RefreshInstance(instanceList map[string][]discover.MicroService) }
type LoadBalanceRule ¶
type LoadBalanceRule string
type WRRBalancer ¶
func NewWRRBalancer ¶
func NewWRRBalancer(timeout time.Duration) *WRRBalancer
func (*WRRBalancer) NotifyEffect ¶
func (s *WRRBalancer) NotifyEffect(bs *BalancedService, ok bool)
func (*WRRBalancer) PickInstance ¶
func (s *WRRBalancer) PickInstance(serviceName string, ctx *common.RequestCtx) *BalancedService
func (*WRRBalancer) RefreshInstance ¶
func (s *WRRBalancer) RefreshInstance(instanceList map[string][]discover.MicroService)
Click to show internal directories.
Click to hide internal directories.