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 ReadyNotifer

type ReadyNotifer interface {
	WorkerReady(chan Request)
}

type Request

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

type Scheduler

type Scheduler interface {
	// Scheduler组合 ReadyNotifer 接口
	ReadyNotifer

	// interface{}定义方法不需要参数名 指明参数类型即可
	// 分发Engine所在协程创建的Request任务
	Submit(Request)

	// 总控调度
	Run()

	// refactor[:1]
	// Engine问Scheduler 我有1个worker 调度给我哪个 chan Request
	WorkerChan() chan Request
}

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