Module lhttpc_manager

Connection manager for the HTTP client.

Behaviours: gen_server.

Authors: Oscar Hellström (oscar@hellstrom.st), Filipe David Manana (fdmanana@apache.org).

Description

Connection manager for the HTTP client. This gen_server is responsible for keeping track of persistent connections to HTTP servers. The only interesting API is connection_count/0 and connection_count/1. The gen_server is supposed to be started by a supervisor, which is normally lhttpc_sup.

Data Types

host()

host() = string() | {integer(), integer(), integer(), integer()}

invalid_option()

invalid_option() = any()

option()

option() = {connect_timeout, timeout()} | {send_retry, non_neg_integer()} | {partial_upload, non_neg_integer() | infinity} | {partial_download, [partial_download_option()]} | {connect_options, socket_options()} | {proxy, string()} | {proxy_ssl_options, socket_options()} | {pool, pid() | atom()} | invalid_option()

options()

options() = [option()]

partial_download_option()

partial_download_option() = {window_size, window_size()} | {part_size, non_neg_integer() | infinity} | invalid_option()

pool_id()

pool_id() = pid() | atom()

port_num()

port_num() = 1..65535

socket()

socket() = term()

socket_options()

socket_options() = [{atom(), term()} | atom()]

window_size()

window_size() = non_neg_integer() | infinity

Function Index

client_count/1Returns the total number of active clients maintained by the specified lhttpc pool (manager).
client_done/5A client has finished one request and returns the socket to the pool, which can be new or not.
connection_count/1Returns the total number of active connections maintained by the specified lhttpc pool (manager).
connection_count/2Returns the number of active connections to the specific Destination maintained by the httpc manager.
dump_settings/1Returns the current settings in state for the specified lhttpc pool (manager).
ensure_call/6If call contains pool_ensure option, dynamically create the pool with configured parameters.
list_pools/0Lists all the pools already started.
set_max_pool_size/2Sets the maximum pool size for the specified pool.
start_link/0Starts and link to the gen server.
start_link/1
update_connection_timeout/2Updates the timeout for persistent connections.

Function Details

client_count/1

client_count(PidOrName::PoolPidOrName) -> Count

Returns the total number of active clients maintained by the specified lhttpc pool (manager).

client_done/5

client_done(Pool::pid(), Host::host(), Port::port_num(), Ssl::boolean(), Socket::socket()) -> ok

A client has finished one request and returns the socket to the pool, which can be new or not.

connection_count/1

connection_count(PidOrName::PoolPidOrName) -> Count

Returns the total number of active connections maintained by the specified lhttpc pool (manager).

connection_count/2

connection_count(PidOrName::PoolPidOrName, X2::Destination) -> Count

Returns the number of active connections to the specific Destination maintained by the httpc manager.

dump_settings/1

dump_settings(PidOrName::PoolPidOrName) -> list()

Returns the current settings in state for the specified lhttpc pool (manager).

ensure_call/6

ensure_call(Pool::pool_id(), Pid::pid(), Host::host(), Port::port_num(), Ssl::boolean(), Options::options()) -> socket() | no_socket

If call contains pool_ensure option, dynamically create the pool with configured parameters. Checks the pool for a socket connected to the destination and returns it if it exists, 'undefined' otherwise.

list_pools/0

list_pools() -> term()

Lists all the pools already started.

set_max_pool_size/2

set_max_pool_size(PidOrName::pool_id(), Size::non_neg_integer()) -> ok

Sets the maximum pool size for the specified pool.

start_link/0

start_link() -> {ok, pid()}

Starts and link to the gen server. This is normally called by a supervisor.

start_link/1

start_link(Options0::[{atom(), non_neg_integer()}]) -> {ok, pid()} | {error, already_started}

update_connection_timeout/2

update_connection_timeout(PidOrName::PoolPidOrName, Milliseconds::Timeout) -> ok

Updates the timeout for persistent connections. This will only affect future sockets handed to the manager. The sockets already managed will keep their timers.


Generated by EDoc, Jul 22 2022, 03:53:27.