scheduling

package
v0.1.72 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSchedulingTypes

func AllSchedulingTypes() []maps.Map

所有请求类型

func FindSchedulingType

func FindSchedulingType(code string) maps.Map

Types

type CandidateInterface

type CandidateInterface interface {
	// 权重
	CandidateWeight() uint

	// 代号
	CandidateCodes() []string
}

候选对象接口

type HashScheduling

type HashScheduling struct {
	Scheduling
	// contains filtered or unexported fields
}

Hash调度算法

func (*HashScheduling) Next

获取下一个候选对象

func (*HashScheduling) Start

func (this *HashScheduling) Start()

启动

func (*HashScheduling) Summary

func (this *HashScheduling) Summary() maps.Map

获取简要信息

type RandomScheduling

type RandomScheduling struct {
	Scheduling
	// contains filtered or unexported fields
}

随机调度算法

func (*RandomScheduling) Next

获取下一个候选对象

func (*RandomScheduling) Start

func (this *RandomScheduling) Start()

启动

func (*RandomScheduling) Summary

func (this *RandomScheduling) Summary() maps.Map

获取简要信息

type RoundRobinScheduling

type RoundRobinScheduling struct {
	Scheduling
	// contains filtered or unexported fields
}

轮询调度算法

func (*RoundRobinScheduling) Next

获取下一个候选对象

func (*RoundRobinScheduling) Start

func (this *RoundRobinScheduling) Start()

启动

func (*RoundRobinScheduling) Summary

func (this *RoundRobinScheduling) Summary() maps.Map

获取简要信息

type Scheduling

type Scheduling struct {
	Candidates []CandidateInterface
}

调度算法基础类

func (*Scheduling) Add

func (this *Scheduling) Add(candidate ...CandidateInterface)

添加候选对象

func (*Scheduling) HasCandidates

func (this *Scheduling) HasCandidates() bool

判断是否有候选对象

type SchedulingInterface

type SchedulingInterface interface {
	// 是否有候选对象
	HasCandidates() bool

	// 添加候选对象
	Add(candidate ...CandidateInterface)

	// 启动
	Start()

	// 查找下一个候选对象
	Next(call *shared.RequestCall) CandidateInterface

	// 获取简要信息
	Summary() maps.Map
}

调度算法接口

type StickyScheduling

type StickyScheduling struct {
	Scheduling
	// contains filtered or unexported fields
}

Sticky调度算法

func (*StickyScheduling) Next

获取下一个候选对象

func (*StickyScheduling) Start

func (this *StickyScheduling) Start()

启动

func (*StickyScheduling) Summary

func (this *StickyScheduling) Summary() maps.Map

获取简要信息

Jump to

Keyboard shortcuts

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