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.

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/1Starts and link to the gen server (with options).
update_connection_timeout/2Updates the timeout for persistent connections.

Function Details

client_count/1

client_count(PidOrName::lhttpc:pool_id()) -> non_neg_integer()

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

client_done/5

client_done(Pool::pid(), Host::lhttpc:host(), Port::lhttpc:port_num(), Ssl::boolean(), Socket::lhttpc: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::lhttpc:pool_id()) -> non_neg_integer()

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

connection_count/2

connection_count(PidOrName::lhttpc:pool_id(), X2::lhttpc:destination()) -> non_neg_integer()

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

dump_settings/1

dump_settings(PidOrName::lhttpc:pool_id()) -> list()

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

ensure_call/6

ensure_call(Pool::lhttpc:pool_id(), Pid::pid(), Host::lhttpc:host(), Port::lhttpc:port_num(), Ssl::boolean(), Options::lhttpc:options()) -> lhttpc: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::lhttpc:pool_id(), Size::non_neg_integer()) -> ok

Sets the maximum pool size for the specified pool.

start_link/0

start_link() -> {ok, pid()} | {error, already_started}

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}

Starts and link to the gen server (with options). This is normally called by a supervisor.

update_connection_timeout/2

update_connection_timeout(PidOrName::lhttpc:pool_id(), Milliseconds::non_neg_integer()) -> 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