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.
 
 

24 lines
407 B

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
}