engine

package
v0.0.0-...-9dec8c7 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT 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
	ItemChan    chan Item
}

func (*ConcurrentEngine) Run

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

type FuncParser

type FuncParser struct {
	// contains filtered or unexported fields
}

func NewFuncParser

func NewFuncParser(p ParserFunc, name string) *FuncParser

func (*FuncParser) Parse

func (f *FuncParser) Parse(contents []byte, url string) ParseResult

func (*FuncParser) Serialize

func (f *FuncParser) Serialize() (name string, args interface{})

type Item

type Item struct {
	Url     string
	Type    string
	Id      string
	Payload interface{}
}

type NilParser

type NilParser struct{}

func (NilParser) Parse

func (NilParser) Parse(_ []byte, _ string) ParseResult

func (NilParser) Serialize

func (NilParser) Serialize() (name string, args interface{})

type ParseResult

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

type Parser

type Parser interface {
	Parse(contents []byte, url string) ParseResult
	Serialize() (name string, args interface{})
}

type ParserFunc

type ParserFunc func(contents []byte, url string) ParseResult

type ReadyNotifier

type ReadyNotifier interface {
	WorkerReady(chan Request)
}

type Request

type Request struct {
	Url    string
	Parser Parser
}

type Scheduler

type Scheduler interface {
	ReadyNotifier
	Submit(Request)
	WorkerChan() 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