You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
407 B
25 lines
407 B
2 years ago
|
package selector
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type Balancer interface {
|
||
|
Pick(ctx context.Context, nodes []WeightedNode) (selected WeightedNode, di DoneFunc, err error)
|
||
|
}
|
||
|
type BalancerBuilder interface {
|
||
|
Build() Balancer
|
||
|
}
|
||
|
type WeightedNode interface {
|
||
|
Node
|
||
|
Raw() Node
|
||
|
Weight() float64
|
||
|
Pick() DoneFunc
|
||
|
PickElapsed() time.Duration
|
||
|
}
|
||
|
|
||
|
type WeightedNodeBuilder interface {
|
||
|
Build(Node) WeightedNode
|
||
|
}
|