fetcher

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMethodNotRegister = errors.New("method requested not registered")

Functions

This section is empty.

Types

type ChromeFactory

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

func NewChromeFactory

func NewChromeFactory() *ChromeFactory

func (*ChromeFactory) Create

func (f *ChromeFactory) Create() (Fetcher, error)

func (*ChromeFactory) Destroy

func (f *ChromeFactory) Destroy(fetcher Fetcher)

func (*ChromeFactory) IsChromeInstalled

func (f *ChromeFactory) IsChromeInstalled() bool

type ChromeFetcher

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

func (*ChromeFetcher) Fetch

func (c *ChromeFetcher) Fetch(url string) (string, error)

type FetchMethod

type FetchMethod string

type Fetcher

type Fetcher interface {
	Fetch(url string) (string, error)
}

type FetcherFactory

type FetcherFactory interface {
	Create() (Fetcher, error)
	Destroy(Fetcher)
}

type FetcherPool

type FetcherPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewPool

func NewPool() *FetcherPool

func (*FetcherPool) Get

func (f *FetcherPool) Get(ctx context.Context, method FetchMethod) (*puddle.Resource[Fetcher], error)

func (*FetcherPool) Methods

func (f *FetcherPool) Methods() []FetchMethod

func (*FetcherPool) Register

func (f *FetcherPool) Register(method FetchMethod, factory FetcherFactory, maxSize int) error

type HTTPFactory

type HTTPFactory struct {
}

func (*HTTPFactory) Create

func (f *HTTPFactory) Create() (Fetcher, error)

func (*HTTPFactory) Destroy

func (f *HTTPFactory) Destroy(fetcher Fetcher)

type HTTPFetcher

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

func (*HTTPFetcher) Fetch

func (h *HTTPFetcher) Fetch(url string) (string, error)

type RodFactory added in v1.2.0

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

func NewRodFactory added in v1.2.0

func NewRodFactory() *RodFactory

func (*RodFactory) Create added in v1.2.0

func (f *RodFactory) Create() (Fetcher, error)

func (*RodFactory) Destroy added in v1.2.0

func (f *RodFactory) Destroy(fetcher Fetcher)

type RodFetcher added in v1.2.0

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

func (*RodFetcher) Fetch added in v1.2.0

func (c *RodFetcher) Fetch(url string) (string, error)

Jump to

Keyboard shortcuts

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