engine

package
v0.0.0-...-daf5e5e Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Scheduler   Scheduler
	WorkerCount int
	ItemChan    chan Item
}

Engine 初始解析入口

func (*Engine) Run

func (e *Engine) Run(reqs ...Request)

Run 启动解析引擎

type Item

type Item struct {
	ID      string
	URL     string
	Type    string
	Payload interface{}
}

Item 数据实体

type ParseResult

type ParseResult struct {
	Requests []Request
	Items    []Item
}

RequestResult 解析结果

type ReadyNotifier

type ReadyNotifier interface {
	WorkerReady(chan Request)
}

ReadyNotifier ...

type Request

type Request struct {
	URL       string
	ParseFunc func(doc *goquery.Document) (ParseResult, error)
}

Request 解析任务

type Scheduler

type Scheduler interface {
	ReadyNotifier
	WorkChan() chan Request
	Run()
	Submit(Request)
}

Scheduler ...

Jump to

Keyboard shortcuts

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