You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2010/08/31 00:05:22 UTC
svn commit: r990974 - in /incubator/thrift/trunk/lib/erl/include:
thrift_protocol.hrl thrift_protocol_impl.hrl
Author: dreiss
Date: Mon Aug 30 22:05:22 2010
New Revision: 990974
URL: http://svn.apache.org/viewvc?rev=990974&view=rev
Log:
erlang: Add some more detailed specs for protocol implementations
Modified:
incubator/thrift/trunk/lib/erl/include/thrift_protocol.hrl
incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl
Modified: incubator/thrift/trunk/lib/erl/include/thrift_protocol.hrl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/erl/include/thrift_protocol.hrl?rev=990974&r1=990973&r2=990974&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/erl/include/thrift_protocol.hrl (original)
+++ incubator/thrift/trunk/lib/erl/include/thrift_protocol.hrl Mon Aug 30 22:05:22 2010
@@ -27,5 +27,36 @@
-record(protocol_list_begin, {etype, size}).
-record(protocol_set_begin, {etype, size}).
+-type tprot_header_val() :: #protocol_message_begin{}
+ | #protocol_struct_begin{}
+ | #protocol_field_begin{}
+ | #protocol_map_begin{}
+ | #protocol_list_begin{}
+ | #protocol_set_begin{}
+ .
+-type tprot_empty_tag() :: message_end
+ | struct_begin
+ | struct_end
+ | field_end
+ | map_end
+ | list_end
+ | set_end
+ .
+-type tprot_header_tag() :: message_begin
+ | field_begin
+ | map_begin
+ | list_begin
+ | set_begin
+ .
+-type tprot_data_tag() :: ui32
+ | bool
+ | byte
+ | i16
+ | i32
+ | i64
+ | double
+ | string
+ .
+
-endif.
Modified: incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl?rev=990974&r1=990973&r2=990974&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl (original)
+++ incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl Mon Aug 30 22:05:22 2010
@@ -24,8 +24,14 @@
-spec flush_transport(state()) -> ok.
-spec close_transport(state()) -> ok.
+
-spec write(state(), term()) -> ok | {error, _Reason}.
--spec read(state(), term()) -> term().
+
+-spec read
+ (state(), non_neg_integer()) -> {ok, binary()} | {error, _Reason};
+ (state(), tprot_empty_tag()) -> ok | {error, _Reason};
+ (state(), tprot_header_tag()) -> tprot_header_val() | {error, _Reason};
+ (state(), tprot_data_tag()) -> {ok, term()} | {error, _Reason}.
-endif.