-
Notifications
You must be signed in to change notification settings - Fork 45
/
shackle.hrl
55 lines (49 loc) · 1.74 KB
/
shackle.hrl
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
%% records
-record(cast, {
client :: client(),
pid :: undefined | pid(),
request :: term(),
request_id :: request_id()
}).
-record(pool_options, {
backlog_size :: backlog_size(),
client :: client(),
pool_size :: pool_size(),
pool_strategy :: pool_strategy()
}).
-record(reconnect_state, {
current :: undefined | time(),
max :: time() | infinity,
min :: none | time()
}).
%% types
-type backlog_size() :: pos_integer() | infinity.
-type cast() :: #cast {}.
-type client() :: module().
-type client_option() :: {ip, inet:ip_address() | inet:hostname()} |
{port, inet:port_number()} |
{protocol, protocol()} |
{reconnect, boolean()} |
{reconnect_time_max, time()} |
{reconnect_time_min, time()} |
{socket_options, [gen_tcp:connect_option() | gen_udp:option()]}.
-type client_options() :: [client_option()].
-type external_request_id() :: term().
-type pool_name() :: atom().
-type pool_option() :: {backlog_size, backlog_size()} |
{pool_size, pool_size()} |
{pool_strategy, pool_strategy()}.
-type pool_options() :: [pool_option()].
-type pool_options_rec() :: #pool_options {}.
-type pool_size() :: pos_integer().
-type pool_strategy() :: random | round_robin.
-type protocol() :: shackle_tcp | shackle_udp.
-type reconnect_state() :: #reconnect_state {}.
-type request_id() :: {server_name(), reference()}.
-type response() :: {external_request_id(), term()}.
-type server_name() :: atom().
-type time() :: pos_integer().
-export_type([
client_options/0,
pool_options/0
]).