-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathshackle_client.erl
More file actions
39 lines (30 loc) · 1.46 KB
/
Copy pathshackle_client.erl
File metadata and controls
39 lines (30 loc) · 1.46 KB
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
-module(shackle_client).
-optional_callbacks([handle_timeout/2]).
-callback init(Options :: term()) ->
{ok, State :: term()} |
{error, Reason :: term()}.
-callback setup(Socket :: inet:socket(), State :: term()) ->
{ok, State :: term()} |
{error, Reason :: term(), State :: term()}.
-callback handle_request(Request :: term(), State :: term()) ->
{ok, RequestId :: shackle:external_request_id(), Data :: iodata(), State :: term()}.
-callback handle_data(Data :: binary(), State :: term()) ->
{ok, [Response :: shackle:response()], State :: term()} |
{error, Reason :: term(), State :: term()}.
-callback handle_timeout(RequestId :: shackle:external_request_id(), State :: term()) ->
{ok, Response :: shackle:response(), State :: term()} |
{error, Reason :: term(), State :: term()}.
-callback terminate(State :: term()) ->
ok.
-type option() :: {address, shackle:inet_address()} |
{init_options, shackle_server:init_options()} |
{ip, shackle:inet_address()} |
{max_requests, pos_integer() | infinity} |
{port, shackle:inet_port()} |
{protocol, shackle:protocol()} |
{reconnect, boolean()} |
{reconnect_time_max, shackle:time() | infinity} |
{reconnect_time_min, shackle:time()} |
{socket_options, shackle:socket_options()}.
-type options() :: [option()].
-export_type([options/0]).