strategy.go 836 B

12345678910111213141516171819202122
  1. package routing
  2. import "time"
  3. // BalancingStrategy is the interface for balancing strategies
  4. type BalancingStrategy interface {
  5. // Pick pick one outbound from candidates. Unlike the SelectAndPick(),
  6. // it skips the select procedure (select all & pick one).
  7. Pick(candidates []string) string
  8. // SelectAndPick selects qualified nodes from candidates then pick one.
  9. SelectAndPick(candidates []string) string
  10. // GetInformation gets information of the strategy
  11. GetInformation(tags []string) *StrategyInfo
  12. }
  13. // BalancingOverrider is the interface of those who can override
  14. // the selecting of its balancers
  15. type BalancingOverrider interface {
  16. // OverrideSelecting overrides the selects of specified balancer, for 'validity'
  17. // duration of time.
  18. OverrideSelecting(balancer string, selects []string, validity time.Duration) error
  19. }