schedule

package
v0.0.0-...-d989b54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultWeight = 10 //节点默认权重
)
View Source
var (
	ErrNoInstance = errors.New("service has no instance")
)

Functions

func NewRandomScheduler

func NewRandomScheduler() *randomScheduler

func NewRoundRobinScheduler

func NewRoundRobinScheduler() *roundRobinScheduler

func NewSmoothWeightedScheduler

func NewSmoothWeightedScheduler() *smoothWeightedScheduler

Types

type OpOption

type OpOption func(*option)

type Scheduler

type Scheduler interface {
	//初始化
	Init(opts ...OpOption) error
	//service变更后需要执行的操作,比如Instance根据机房的流量权重进行重新计算
	Build(service *dm.Service) error
	//根据调度策略返回一个可用的实例
	Select() (*dm.Instance, error)
	//scheduler类型
	Type() string
}

client 选取服务节点的interface TODO 如果调用某个服务的失败次数过多,是否适当降低该节点权重

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL