scheduler

package
v0.0.0-...-3a892f2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(conf ...*cache.AppConf)

func PauseRecover

func PauseRecover()

暂停\恢复所有爬行任务

func Stop

func Stop()

终止任务

Types

type Matrix

type Matrix struct {
	sync.Mutex
	// contains filtered or unexported fields
}

一个Spider实例的请求矩阵

func AddMatrix

func AddMatrix(spiderName, spiderSubName string, config *cache.AppConf) *Matrix

注册资源队列

func (*Matrix) CanStop

func (self *Matrix) CanStop() bool

func (*Matrix) DoHistory

func (self *Matrix) DoHistory(req *request.Request, ok bool) bool

返回是否作为新的失败请求被添加至队列尾部

func (*Matrix) Free

func (self *Matrix) Free()

func (*Matrix) Len

func (self *Matrix) Len() int

func (*Matrix) Pull

func (self *Matrix) Pull() (req *request.Request)

从队列取出请求,不存在时返回nil,并发安全

func (*Matrix) Push

func (self *Matrix) Push(req *request.Request)

添加请求到队列,并发安全

func (*Matrix) TryFlushFailure

func (self *Matrix) TryFlushFailure()

非服务器模式下保存历史失败记录

func (*Matrix) TryFlushSuccess

func (self *Matrix) TryFlushSuccess()

非服务器模式下保存历史成功记录

func (*Matrix) Use

func (self *Matrix) Use()

func (*Matrix) Wait

func (self *Matrix) Wait()

等待处理中的请求完成

Jump to

Keyboard shortcuts

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