shackle_client behaviour (shackle v0.7.1)
View SourceSummary
Types
-type option() :: {address, shackle:inet_address()} | {init_options, shackle_server:init_options()} | {ip, shackle:inet_address()} | {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()].
Callbacks
-callback handle_request(Request :: term(), State :: term()) -> {ok, RequestId :: shackle:external_request_id(), Data :: iodata(), State :: term()}.
-callback handle_timeout(RequestId :: shackle:external_request_id(), State :: term()) -> {ok, Response :: shackle:response(), State :: term()} | {error, Reason :: term(), State :: term()}.
-callback setup(Socket :: inet:socket(), State :: term()) -> {ok, State :: term()} | {error, Reason :: term(), State :: term()}.
-callback terminate(State :: term()) -> ok.