engine

package
v0.0.0-...-fd39805 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: Apache-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 ConcurrentEngine

type ConcurrentEngine struct {
	Scheduler        Scheduler
	WorkerCount      int
	ItemChan         chan Item
	RequestProcessor Processor
}

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
}

func Worker

func Worker(r Request) (ParseResult, error)

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 Processor

type Processor func(Request) (ParseResult, error)

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