base

package
v0.0.0-...-f53f79a Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: MIT, GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger() logging.Logger

创建日志记录器。

Types

type Args

type Args interface {
	// 自检参数的有效性,并在必要时返回可以说明问题的错误值。
	// 若结果值为nil,则说明未发现问题,否则就意味着自检未通过。
	Check() error
	// 获得参数容器的字符串表现形式。
	String() string
}

参数容器的接口。

type ChannelArgs

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

通道参数的容器。

func NewChannelArgs

func NewChannelArgs(
	reqChanLen uint,
	respChanLen uint,
	itemChanLen uint,
	errorChanLen uint) ChannelArgs

创建通道参数的容器。

func (*ChannelArgs) Check

func (args *ChannelArgs) Check() error

func (*ChannelArgs) ErrorChanLen

func (args *ChannelArgs) ErrorChanLen() uint

获得错误通道的长度。

func (*ChannelArgs) ItemChanLen

func (args *ChannelArgs) ItemChanLen() uint

获得条目通道的长度。

func (*ChannelArgs) ReqChanLen

func (args *ChannelArgs) ReqChanLen() uint

获得请求通道的长度。

func (*ChannelArgs) RespChanLen

func (args *ChannelArgs) RespChanLen() uint

获得响应通道的长度。

func (*ChannelArgs) String

func (args *ChannelArgs) String() string

type CrawlerError

type CrawlerError interface {
	Type() ErrorType // 获得错误类型。
	Error() string   // 获得错误提示信息。
}

爬虫错误的接口。

func NewCrawlerError

func NewCrawlerError(errType ErrorType, errMsg string) CrawlerError

创建一个新的爬虫错误。

type Data

type Data interface {
	Valid() bool // 数据是否有效。
}

数据的接口。

type ErrorType

type ErrorType string

错误类型。

const (
	DOWNLOADER_ERROR     ErrorType = "Downloader Error"
	ANALYZER_ERROR       ErrorType = "Analyzer Error"
	ITEM_PROCESSOR_ERROR ErrorType = "Item Processor Error"
)

错误类型常量。

type Item

type Item map[string]interface{}

条目。

func (Item) Valid

func (item Item) Valid() bool

数据是否有效。

type PoolBaseArgs

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

池基本参数的容器。

func NewPoolBaseArgs

func NewPoolBaseArgs(
	pageDownloaderPoolSize uint32,
	analyzerPoolSize uint32) PoolBaseArgs

创建池基本参数的容器。

func (*PoolBaseArgs) AnalyzerPoolSize

func (args *PoolBaseArgs) AnalyzerPoolSize() uint32

获得分析器池的尺寸。

func (*PoolBaseArgs) Check

func (args *PoolBaseArgs) Check() error

func (*PoolBaseArgs) PageDownloaderPoolSize

func (args *PoolBaseArgs) PageDownloaderPoolSize() uint32

获得网页下载器池的尺寸。

func (*PoolBaseArgs) String

func (args *PoolBaseArgs) String() string

type Request

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

请求。

func NewRequest

func NewRequest(httpReq *http.Request, depth uint32) *Request

创建新的请求。

func (*Request) Depth

func (req *Request) Depth() uint32

获取深度值。

func (*Request) HttpReq

func (req *Request) HttpReq() *http.Request

获取HTTP请求。

func (*Request) Valid

func (req *Request) Valid() bool

数据是否有效。

type Response

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

响应。

func NewResponse

func NewResponse(httpResp *http.Response, depth uint32) *Response

创建新的响应。

func (*Response) Depth

func (resp *Response) Depth() uint32

获取深度值。

func (*Response) HttpResp

func (resp *Response) HttpResp() *http.Response

获取HTTP响应。

func (*Response) Valid

func (resp *Response) Valid() bool

数据是否有效。

Jump to

Keyboard shortcuts

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