package resource-pooling

  1. Overview
  2. Docs

Module Server_pool.MakeSource

Parameters

module Conf : CONF

Signature

Sourcetype server_status = {
  1. serverid : Conf.serverid;
  2. desired : int;
  3. current : int;
  4. essential : bool;
  5. suspended : bool;
  6. check_server : unit -> bool Lwt.t;
  7. connections : Conf.connection Resource_pool.t;
}
Sourceval servers : unit -> Conf.serverid list
Sourceval server_statuses : unit -> server_status list
Sourceval server_exists : Conf.serverid -> bool
Sourceval remove : Conf.serverid -> unit

remove marks a given server as removed from the pool. HOWEVER, a number of attempts (corresponding to the number of connections to that server) to use that server might still occur. These are NOT connection attempts, so this does not come with substantial costs.

Sourceval non_essential_active_connection_pools : unit -> (Conf.serverid * Conf.connection Resource_pool.t) list
Sourceval add_one : ?essential:bool -> ?connect_immediately:bool -> num_conn:int -> Conf.serverid -> Conf.server -> unit

Adds a server to the pool, permitting a maximum number num_conn of concurrent connections to that server. If connect_immediately is true (default: false then num_conn are immediately opened to the server. If the given server exists already no action is taken. If essential is true (default: true) then the added server is protected from being suspended.

Sourceval add_many : ?essential:bool -> ?connect_immediately:bool -> num_conn:int -> (Conf.serverid * Conf.server) list -> unit
Sourceval add_existing : ?essential:bool -> ?check_server:(unit -> bool Lwt.t) -> num_conn:int -> Conf.serverid -> Conf.connection Resource_pool.t -> unit
Sourceval use : ?usage_attempts:int -> (Conf.connection -> 'a Lwt.t) -> 'a Lwt.t