Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Balancer ¶
type Balancer interface { Count() int All() []Endpoint Add(peers ...Endpoint) Remove(peer Endpoint) Clear() // contains filtered or unexported methods }
Balancer represents a generic load balancer. For the real world, Balancer is a useful interface rather than balancer.
type Constrainable ¶
type Constrainable interface { CanConstrain(o interface{}) (yes bool) Check(o interface{}) (satisfied bool) Endpoint }
Constrainable is an object who can be applied onto a factor ( balancer.Next(factor) )
type DeepEqualAware ¶
DeepEqualAware could be concreted by an Endpoint
type Endpoint ¶
type Endpoint interface { // String will return the main identity string of a endpoint. String() string }
Endpoint is a backend object, such as a host+port, a http/https url, or a constraint expression, and so on.
type Factor ¶
type Factor interface {
Factor() string
}
Factor is a factor parameter for balancer.Next.
type FactorComparable ¶
type FactorComparable interface { Factor ConstrainedBy(constraints interface{}) (peer Endpoint, c Constrainable, satisfied bool) }
FactorComparable is a composite interface which assembly Factor and constraint comparing.
type FactorString ¶
type FactorString string
FactorString is a string type, it implements Factor interface.
const DummyFactor FactorString = "robin"
DummyFactor will be used in someone like you does not known what on earth should be passed into balancer.Next(factor).
func (FactorString) Factor ¶
func (s FactorString) Factor() string
Factor function impl Factor interface