module ManagedClient:sig..end
Managed clients are Rpc_client clients with the ability to
      reconnect in the case of errors.
Additional features:
Initial pings are useful to test whether the connection is
      really working. Servers normally accept new TCP connections without
      knowing whether there are resources for processing the connections
      (i.e. whether there is a process or thread waiting for serving
      it). Because of this, the client cannot assume that the TCP
      connection is really up only because the connect system call
      said the connection is there. The initial ping fixes this problem:
      The null procedure is once called after the TCP connection has
      been established. Only when this works the client believes the
      connection is really up. It is required that mclient_programs
      is configured with at least one program, and this program must
      have a procedure number 0 of type void -> void.
In multi-threaded programs, threads must not share managed clients.
Managed clients can be used together with ocamlrpcgen-generated
      modules. Provided the generated module M_clnt contains the
      client code for program P and version V, one can do
         module MC = M_clnt.Make'P(Rpc_proxy.ManagedClient)
      and call RPCs f as in
         let res = MC.V.f mc arg
      (if mc is the managed client, and arg the argument).
type 
A managed client
type |    | mclient_rcache :  | (* | The rcache | *) | 
|    | mclient_socket_config :  | (* | The socket configuration | *) | 
|    | mclient_idle_timeout :  | (* | After how many seconds unused connections are closed. A negative value means never. 0 means immediately. A positive value is a point in time in the future. | *) | 
|    | mclient_programs :  | (* | The programs to bind | *) | 
|    | mclient_msg_timeout :  | (* | After how many seconds the reply must have been arrived. A negative value means there is no timeout. 0 means immediately. A positive value is a point in time in the future. | *) | 
|    | mclient_msg_timeout_is_fatal :  | (* | Whether a message timeout is to be considered as fatal error (the client is shut down, and the error counter for the endpoint is increased) | *) | 
|    | mclient_exception_handler :  | (* | Whether to call  | *) | 
|    | mclient_auth_methods :  | (* | Set these authentication methods in the client | *) | 
|    | mclient_user_name :  | (* | The user name for authentication, None = default user | *) | 
|    | mclient_initial_ping :  | (* | Whether to call procedure 0 of the first program after connection establishment (see comments above) | *) | 
|    | mclient_max_response_length :  | (* | The maximum response length. See 
               | *) | 
|    | mclient_mstring_factories :  | (* | The factories to use for decoding managed strings | *) | 
Procedure calls may end with this exception when the reliability cache disables the service
val create_mclient_config : ?rcache:Rpc_proxy.ReliabilityCache.rcache ->
       ?socket_config:Rpc_client.socket_config ->
       ?idle_timeout:float ->
       ?programs:Rpc_program.t list ->
       ?msg_timeout:float ->
       ?msg_timeout_is_fatal:bool ->
       ?exception_handler:(exn -> unit) ->
       ?auth_methods:Rpc_client.auth_method list ->
       ?user_name:string option ->
       ?initial_ping:bool ->
       ?max_response_length:int ->
       ?mstring_factories:Netxdr_mstring.named_mstring_factories ->
       unit -> mclient_configCreate a config record. The optional arguments set the config components with the same name. The defaults are:
rcache: Use the global reliability cachesocket_config: Rpc_client.default_socket_configprograms: The empty list. It is very advisable to fill this!msg_timeout: (-1), i.e. nonemsg_timeout_is_fatal: falseexception_handler: Noneauth_methods: empty listuser_name: Noneinitial_ping: falsemax_response_length: Nonemstring_factories: Noneval create_mclient : mclient_config ->
       Rpc_client.connector ->
       Unixqueue.event_system -> mclientCreate a managed client for this config connecting to this
        connector. Only Internet and Unix connectors are supported.
typestate =[ `Connecting | `Down | `Up of Unix.sockaddr option ]
The state:
`Down: The initial state, and also reached after a socket
             error, or after one of the shutdown functions is called.
             Although `Down, there might still some cleanup to do.
             When RPC functions are called, the client is automatically
             revived.`Connecting: This state is used while the initial ping is
             done. It does not reflect whether the client is really 
             TCP-connected. Without initial ping, this state cannot occur.`Up s: The client is (so far known) up and can be used.
             s is the socket address of the local socketval mclient_state : mclient -> stateGet the state
val mclient_serial : mclient -> intGet the serial number of the connection. The serial number is increased when the client is reconnected. If the client is down the serial number of the next connection attempt is returned.
val pending_calls : mclient -> intReturns the number of pending calls
val event_system : mclient -> Unixqueue.event_systemReturn the event system
val shut_down : mclient -> unit
val sync_shutdown : mclient -> unit
val trigger_shutdown : mclient -> (unit -> unit) -> unitShut down the managed client. See the corresponding functions
        Rpc_client.shut_down, Rpc_client.sync_shutdown, and
        Rpc_client.trigger_shutdown
 : mclient -> unitIncreases the error counter in the reliability cache for this
        connection. The only effect can be that the error counter
        exceeds the rcache_threshold so that the server endpoint
        is disabled for some time. However, this only affects new 
        connections, not existing ones.
For a stricter interpretation of errors see 
        enforce_unavailability.
The error counter is increased anyway when a socket error
        happens, or an RPC call times out and msg_timeout_is_fatal
        is set. This function can be used to also interpret other
        misbehaviors as fatal errors.
 : mclient -> unitEnforces that all pending procedure calls get the
        Service_unavailable exception, and that the client is shut down.
        The background is this: When the reliability cache discovers an
        unavailable port or host, only the new call is stopped with this
        exception, but older calls remain unaffected. This function
        can be used to change the policy, and to stop even pending calls.
The difference to trigger_shutdown is that the pending RPC
        calls get the exception Service_unavailable instead of
        Rpc_client.Message_lost, and that it is enforced that the
        shutdown is recorded as fatal error in the reliability cache.
val set_batch_call : mclient -> unitThe next call is a batch call. See Rpc_client.set_batch_call
val rpc_engine : mclient ->
       (mclient -> 'a -> ((unit -> 'b) -> unit) -> unit) ->
       'a -> 'b Uq_engines.engineCall an RPC function in engine style:
 let e = rpc_engine mc f_rpc where f_rpc is one of the generated client functions (async
	signature). The engine reaches `Done r when the result r
	has arrived.
The engine is not abortable (shut the client down instead).
val compare : mclient -> mclient -> intManagedClient can be used with Set.Make and Map.Make
include Rpc_client.USE_CLIENT
We implement the USE_CLIENT interface for calling procedures