scheduler

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateRemover

type DuplicateRemover interface {
	//是否重复
	IsDuplicate(request model.Request) bool
	//清除检查重复的数据
	ResetDuplicateCheck()
}

type HashSetDuplicateRemover

type HashSetDuplicateRemover struct {
	Urls map[string]string
}

func (*HashSetDuplicateRemover) IsDuplicate

func (s *HashSetDuplicateRemover) IsDuplicate(request model.Request) bool

func (*HashSetDuplicateRemover) ResetDuplicateCheck

func (s *HashSetDuplicateRemover) ResetDuplicateCheck()

type PriorityQueue

type PriorityQueue []model.Request //自定义优先队列

func (*PriorityQueue) Len

func (queue *PriorityQueue) Len() int

Len 实现sort.Interface

func (*PriorityQueue) Less

func (queue *PriorityQueue) Less(i, j int) bool

Less 实现sort.Interface

func (*PriorityQueue) Pop

func (queue *PriorityQueue) Pop() interface{}

Pop 实现堆接口

func (*PriorityQueue) Push

func (queue *PriorityQueue) Push(request interface{})

Push 实现堆接口

func (*PriorityQueue) Swap

func (queue *PriorityQueue) Swap(i, j int)

Swap 实现sort.Interface

type PriorityScheduler

type PriorityScheduler struct {
	RequestQueue     PriorityQueue    //请求队列
	DuplicateRemover DuplicateRemover //去重器
	IsDuplicate      bool             //是否去重
	// contains filtered or unexported fields
}

PriorityScheduler 优先队列调度器

func (*PriorityScheduler) Len

func (s *PriorityScheduler) Len() int

func (*PriorityScheduler) PollData

func (s *PriorityScheduler) PollData(num int) []model.Request

func (*PriorityScheduler) PushData

func (s *PriorityScheduler) PushData(requests ...model.Request)

type Scheduler

type Scheduler interface {
	PushData(requests ...model.Request)

	PollData(num int) []model.Request

	Len() int
}

Jump to

Keyboard shortcuts

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