engine

package
v0.0.0-...-29babf1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentEngine

type ConcurrentEngine struct {
	Scheduler   Scheduler
	WorkerCount int
}

func (*ConcurrentEngine) Run

func (e *ConcurrentEngine) Run(seeds ...Request)

type ParseResult

type ParseResult struct {
	Requests []Request
	// interface{}是任何类型
	Items []interface{}
}

func NilParser

func NilParser([]byte) ParseResult

type Request

type Request struct {
	Url        string
	ParserFunc func([]byte) ParseResult
}

type Scheduler

type Scheduler interface {
	// interface{}定义方法不需要参数名 指明参数类型即可
	// 分发Engine所在协程创建的Request任务
	Submit(Request)
	// 把Engine.Run方法生成的 in := make(chan Request) 放到接口中
	ConfigureMasterWorkerChan(chan Request)
	// Worker可进行下一轮读取chan操作就绪状态通知
	WorkerReady(chan Request)
	// 总控调度
	Run()
}

type SimpleEngine

type SimpleEngine struct {
}

func (SimpleEngine) Run

func (e SimpleEngine) Run(seeds ...Request)

Jump to

Keyboard shortcuts

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