pool

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

The Config struct contains the internal configuration for a Pool

func New

func New(concurrency, buffer int, timeout time.Duration, collect collector.Collector) *Config

New builds a new Pool

func (*Config) Add

func (pool *Config) Add(request *http.Request, n int) int

Add pushes an item of work to the pool n times, returns the number of items of work that were succeesfully pushed. The returned number may be less than n when the work channel buffer is full.

func (*Config) Start

func (pool *Config) Start() Pool

Start begins the background workers for the pool

func (*Config) Stop

func (pool *Config) Stop()

Stop closes the work channel, causing all workers to stop, it then closes the ResultsChan.

type Pool

type Pool interface {
	Add(*http.Request, int) int
	Start() Pool
	Stop()
}

Pool describes a worker pool interface

Jump to

Keyboard shortcuts

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