engine

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	ParserFunction string
	Adapter        func(e *Engine, task *models.Task) (newTasks []models.Task, err error)
}

type Engine

type Engine struct {
	Store *store.Store // 存储

	HttpClient *http.Client // http客户端
	// contains filtered or unexported fields
}

加入请求时间间隔控制

func NewEngine

func NewEngine(s *store.Store, logPath string, tick time.Duration, threadNum ...int) (*Engine, error)

初始化引擎 @Params s 存储 logPath 日志路径 tick 定时器间隔时长(.eg: tick=number*time.Second) threadNum 线程数(默认1)

func (*Engine) RegisterAdapter

func (e *Engine) RegisterAdapter(adapter Adapter)

func (*Engine) RegisterAdapters

func (e *Engine) RegisterAdapters(adapters []Adapter)

func (*Engine) Run

func (e *Engine) Run()

TODO 加入任务结束逻辑

func (*Engine) SetNewTask

func (e *Engine) SetNewTask(task *models.Task) error

Jump to

Keyboard shortcuts

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