httpclient

package
v0.0.0-...-4308112 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package httpclient provides a worker that manages http clients. The worker is responsible for ensuring that http clients are created with the appropriate configuration.

This is the first iteration of the http client worker, and it is expected that each http client is correctly tracked and managed by the worker. If proxy settings change, the worker will update the http client accordingly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs the http client worker.

func NewTrackedWorker

func NewTrackedWorker(client *internalhttp.Client) (worker.Worker, error)

NewTrackedWorker creates a new tracked worker for a http client.

func NewWorker

func NewWorker(cfg WorkerConfig) (*httpClientWorker, error)

NewWorker creates a new object store worker.

Types

type HTTPClientWorker

type HTTPClientWorker interface {
	corehttp.HTTPClient
	worker.Worker
}

HTTPClientWorker is the interface for the http client worker.

type HTTPClientWorkerFunc

type HTTPClientWorkerFunc func(*internalhttp.Client) (worker.Worker, error)

HTTPClientWorkerFunc is the function signature for creating a new http client worker.

type ManifoldConfig

type ManifoldConfig struct {
	NewHTTPClient       NewHTTPClientFunc
	NewHTTPClientWorker HTTPClientWorkerFunc
	Clock               clock.Clock
	Logger              logger.Logger
}

ManifoldConfig defines the configuration for the http client manifold.

func (ManifoldConfig) Validate

func (cfg ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type NewHTTPClientFunc

type NewHTTPClientFunc func(corehttp.Purpose, ...internalhttp.Option) *internalhttp.Client

NewHTTPClientFunc is the function signature for creating a new http client.

type WorkerConfig

type WorkerConfig struct {
	NewHTTPClient       NewHTTPClientFunc
	NewHTTPClientWorker HTTPClientWorkerFunc
	Clock               clock.Clock
	Logger              logger.Logger
}

WorkerConfig encapsulates the configuration options for the http client worker.

func (*WorkerConfig) Validate

func (c *WorkerConfig) Validate() error

Validate ensures that the config values are valid.

Jump to

Keyboard shortcuts

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