bddutil

package
v0.0.0-...-e472cc8 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPDo

func HTTPDo(method, url string, headers map[string]string, body io.Reader,
	tlsConfig *tls.Config) (*http.Response, error)

HTTPDo makes an HTTP request.

Types

type Request

type Request interface {
	Invoke() (interface{}, error)
}

Request is a request that's submitted to the worker pool for processing.

type Response

type Response struct {
	Request
	Resp interface{}
	Err  error
}

Response is the response for an individual request.

type WorkerPool

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

WorkerPool manages a pool of workers that processes requests concurrently and, at the end, gathers the responses.

func NewWorkerPool

func NewWorkerPool(num int, logger log.Logger) *WorkerPool

NewWorkerPool returns a new worker pool with the given number of workers.

func (*WorkerPool) Responses

func (p *WorkerPool) Responses() []*Response

Responses contains the responses after the pool is stopped.

func (*WorkerPool) Start

func (p *WorkerPool) Start()

Start starts all the workers and listens for responses.

func (*WorkerPool) Stop

func (p *WorkerPool) Stop()

Stop stops the workers in the pool and stops listening for responses.

func (*WorkerPool) Submit

func (p *WorkerPool) Submit(req Request)

Submit submits a request for processing.

Jump to

Keyboard shortcuts

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