Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindSchedulingType ¶
Types ¶
type CandidateInterface ¶
type CandidateInterface interface {
// CandidateWeight 权重
CandidateWeight() uint
// CandidateCodes 代号
CandidateCodes() []string
}
CandidateInterface 候选对象接口
type HashScheduling ¶
type HashScheduling struct {
Scheduling
// contains filtered or unexported fields
}
HashScheduling Hash调度算法
func (*HashScheduling) Next ¶
func (this *HashScheduling) Next(call *shared.RequestCall) CandidateInterface
Next 获取下一个候选对象
type RandomScheduling ¶
type RandomScheduling struct {
Scheduling
// contains filtered or unexported fields
}
RandomScheduling 随机调度算法
func (*RandomScheduling) Next ¶
func (this *RandomScheduling) Next(call *shared.RequestCall) CandidateInterface
Next 获取下一个候选对象
type RoundRobinScheduling ¶
type RoundRobinScheduling struct {
Scheduling
// contains filtered or unexported fields
}
RoundRobinScheduling 轮询调度算法
func (*RoundRobinScheduling) Next ¶
func (this *RoundRobinScheduling) Next(call *shared.RequestCall) CandidateInterface
Next 获取下一个候选对象
func (*RoundRobinScheduling) Summary ¶
func (this *RoundRobinScheduling) Summary() maps.Map
Summary 获取简要信息
type Scheduling ¶
type Scheduling struct {
Candidates []CandidateInterface
}
Scheduling 调度算法基础类
func (*Scheduling) HasCandidates ¶
func (this *Scheduling) HasCandidates() bool
HasCandidates 判断是否有候选对象
type SchedulingInterface ¶
type SchedulingInterface interface {
// HasCandidates 是否有候选对象
HasCandidates() bool
// Add 添加候选对象
Add(candidate ...CandidateInterface)
// Start 启动
Start()
// Next 查找下一个候选对象
Next(call *shared.RequestCall) CandidateInterface
// Summary 获取简要信息
Summary() maps.Map
}
SchedulingInterface 调度算法接口
type StickyScheduling ¶
type StickyScheduling struct {
Scheduling
// contains filtered or unexported fields
}
StickyScheduling Sticky调度算法
func (*StickyScheduling) Next ¶
func (this *StickyScheduling) Next(call *shared.RequestCall) CandidateInterface
Next 获取下一个候选对象
Click to show internal directories.
Click to hide internal directories.