erlang: Add some initial specs to thrift_client and thrift_protocol
Also add a special header for use in thrift_protocol implementations
that gives specs for the callbacks.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@990972 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/src/thrift_client.erl b/lib/erl/src/thrift_client.erl
index 9790250..07c9f48 100644
--- a/lib/erl/src/thrift_client.erl
+++ b/lib/erl/src/thrift_client.erl
@@ -140,6 +140,7 @@
Started
end.
+-spec call(term(), atom(), list()) -> {ok, term()} | {error, term()}.
call(Client, Function, Args)
when is_pid(Client), is_atom(Function), is_list(Args) ->
case gen_server:call(Client, {call, Function, Args}) of
@@ -148,6 +149,7 @@
{exception, Exception} -> throw(Exception)
end.
+-spec cast(term(), atom(), list()) -> ok.
cast(Client, Function, Args)
when is_pid(Client), is_atom(Function), is_list(Args) ->
gen_server:cast(Client, {call, Function, Args}).
@@ -155,10 +157,12 @@
%% Sends a function call but does not read the result. This is useful
%% if you're trying to log non-oneway function calls to write-only
%% transports like thrift_disk_log_transport.
+-spec send_call(term(), atom(), list()) -> ok.
send_call(Client, Function, Args)
when is_pid(Client), is_atom(Function), is_list(Args) ->
gen_server:call(Client, {send_call, Function, Args}).
+-spec close(term()) -> ok.
close(Client) when is_pid(Client) ->
gen_server:cast(Client, close).