httpq

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package httpq is a specialization of queue.AsyncQueue for HTTP requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Workers           int
	DefaultMaxRetries int
	Client            *http.Client
	Errors            chan<- error
}

Config is used to configure the behaviour of the HTTP queue.

type HTTPQueue

type HTTPQueue interface {
	// Add request to the queue. Safe for concurrent use.
	Enqueue(req *Request) error

	// Close the queue.
	io.Closer
}

HTTPQueue sends HTTP requests.

func New

func New(q queue.Queue, pass []byte, cfg *Config) (HTTPQueue, error)

New constructs an async HTTP queue. When a nil config is given, reasonable defaults will be used. If pass is non-nil, requests stored in the queue are encrypted with the password (see github.com/esote/enc for details).

type Request

type Request struct {
	Body   []byte
	Method string
	URL    *url.URL
}

Request represents a future HTTP request sent by the queue.

Jump to

Keyboard shortcuts

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