worker

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Done

type Done struct {
	URI      string
	Response *response.Response
}

Done is a message sent when an upstream worker has completed

type UpstreamWorker

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

UpstreamWorker manages parallel upstream requests

func New

func New(workerCount int, f WorkFunc) *UpstreamWorker

New UpstreamWorker

func (*UpstreamWorker) Do

func (u *UpstreamWorker) Do(uris []string) error

Do runs the worker with the given uris

func (*UpstreamWorker) Responses

func (u *UpstreamWorker) Responses() []Done

Responses returns the responses from the upstream calls

type WorkFunc

type WorkFunc func(uri string) (*response.Response, error)

WorkFunc defines a function which is called when work is to be done

Jump to

Keyboard shortcuts

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