Source file persistent_rpc_client.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
open Core
open Async
module Create_helper (T : sig
include Persistent_connection.S
val conn_of_rpc_connection
: Kerberized_rpc.Connection.t Deferred.Or_error.t
-> conn Deferred.Or_error.t
end) =
struct
include T
let create'
~server_name
?log
?on_event
?retry_delay
?max_message_size
?handshake_timeout
?heartbeat_config
~krb_mode
?bind_to_address
?implementations
?description
?cred_cache
~authorize
get_addr
=
T.create
~server_name
?log
?on_event
?retry_delay
~connect:(fun host_and_port ->
let host, port = Host_and_port.tuple host_and_port in
Kerberized_rpc.Connection.client
?max_message_size
?handshake_timeout
?heartbeat_config
?implementations
?description
?cred_cache
~authorize
~krb_mode
(Tcp.Where_to_connect.of_host_and_port ?bind_to_address { host; port })
|> T.conn_of_rpc_connection)
~address:(module Host_and_port)
get_addr
;;
end
module Rpc = Create_helper (struct
include Persistent_connection.Rpc
let conn_of_rpc_connection = Fn.id
end)
module Versioned_rpc = Create_helper (struct
include Persistent_connection.Versioned_rpc
let conn_of_rpc_connection =
Deferred.Or_error.bind ~f:Versioned_rpc.Connection_with_menu.create
;;
end)