downloader

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenPageDownloader

type GenPageDownloader func() PageDownloader

生成网页下载器的函数类型。

type PageDownloader

type PageDownloader interface {
	Id() uint32                                        // 获得ID。
	Download(req base.Request) (*base.Response, error) // 根据请求下载网页并返回响应。
}

网页下载器的接口类型。

func NewPageDownloader

func NewPageDownloader(client *http.Client) PageDownloader

创建网页下载器。

type PageDownloaderPool

type PageDownloaderPool interface {
	Take() (PageDownloader, error)  // 从池中取出一个网页下载器。
	Return(dl PageDownloader) error // 把一个网页下载器归还给池。
	Total() uint32                  // 获得池的总容量。
	Used() uint32                   // 获得正在被使用的网页下载器的数量。
}

网页下载器池的接口类型。

func NewPageDownloaderPool

func NewPageDownloaderPool(
	total uint32,
	gen GenPageDownloader) (PageDownloaderPool, error)

创建网页下载器池。

Jump to

Keyboard shortcuts

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