Documentation ¶
Index ¶
- Variables
- func GetBalancerType() []string
- type Algorithm
- type Balancer
- type ConsistenceHash
- func (c *ConsistenceHash) Add(host string)
- func (c *ConsistenceHash) Balance(url string) (string, error)
- func (c *ConsistenceHash) Done(_ string)
- func (c *ConsistenceHash) Inc(_ string)
- func (c *ConsistenceHash) Len() int
- func (c *ConsistenceHash) Mode() string
- func (c *ConsistenceHash) Remove(host string)
- type Factory
- type Hash
- type RoundRobin
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoHostError = errors.New("no host") AlgorithmNotSupportedError = errors.New("algorithm not supported") )
Functions ¶
func GetBalancerType ¶
func GetBalancerType() []string
Types ¶
type Balancer ¶
type Balancer interface { Add(string) Remove(string) Balance(string) (string, error) Inc(string) Done(string) Len() int Mode() string }
反向代理的负载均衡器
func NewConsistenceHash ¶
func NewRoundRobin ¶
type ConsistenceHash ¶
func (*ConsistenceHash) Add ¶
func (c *ConsistenceHash) Add(host string)
func (*ConsistenceHash) Len ¶
func (c *ConsistenceHash) Len() int
func (*ConsistenceHash) Mode ¶
func (c *ConsistenceHash) Mode() string
func (*ConsistenceHash) Remove ¶
func (c *ConsistenceHash) Remove(host string)
type RoundRobin ¶
轮询负载均衡器
func (*RoundRobin) Add ¶
func (r *RoundRobin) Add(host string)
func (*RoundRobin) Len ¶
func (r *RoundRobin) Len() int
func (*RoundRobin) Mode ¶
func (r *RoundRobin) Mode() string
func (*RoundRobin) Remove ¶
func (r *RoundRobin) Remove(host string)
Click to show internal directories.
Click to hide internal directories.