Permalink
Browse files

Rollback a few recent Erlang changes to fix blame data

My combined patch for THRIFT-599 was committed, but it is preferable
commit the individual patches to preserve the more detailed log and
blame data.  I'll recommit r987018 as a sequence of patches and r988722
as its own rev.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@990957 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 73af3b7 commit f32d0fb90085009cd53efd402f21d6fe6dcde492 David Reiss committed Aug 30, 2010
@@ -649,8 +649,8 @@ void t_erl_generator::generate_service_interface(t_service* tservice) {
<< "_thrift:function_info(Function, InfoType)." << endl;
indent_down();
} else {
- // Use a special return code for nonexistent functions
- indent(f_service_) << "function_info(_Func, _Info) -> no_function." << endl;
+ // Dummy function_info so we don't worry about the ;s
+ indent(f_service_) << "function_info(xxx, dummy) -> dummy." << endl;
}
indent(f_service_) << endl;
View
@@ -25,19 +25,32 @@ Example
Example session using thrift_client:
-1> {ok, C0} = thrift_client_util:new("localhost", 9090, thriftTest_thrift, []), ok.
-ok
-2> {C1, R1} = thrift_client:call(C0, testVoid, []), R1.
+118> f(), {ok, C} = thrift_client:start_link("localhost", 9090, thriftTest_thrif
+t).
+{ok,<0.271.0>}
+119> thrift_client:call(C, testVoid, []).
{ok,ok}
-3> {C2, R2} = thrift_client:call(C1, testVoid, [asdf]), R2.
+120> thrift_client:call(C, testVoid, [asdf]).
{error,{bad_args,testVoid,[asdf]}}
-4> {C3, R3} = thrift_client:call(C2, testI32, [123]), R3.
+121> thrift_client:call(C, testI32, [123]).
{ok,123}
-5> {C4, R4} = thrift_client:call(C3, testOneway, [1]), R4.
+122> thrift_client:call(C, testOneway, [1]).
{ok,ok}
-6> {C5, R5} = thrift_client:call(C4, testXception, ["foo"]), R5.
+123> catch thrift_client:call(C, testXception, ["foo"]).
{error,{no_function,testXception}}
-7> {C6, R6} = thrift_client:call(C5, testException, ["foo"]), R6.
+124> catch thrift_client:call(C, testException, ["foo"]).
{ok,ok}
-8> {C7, R7} = (catch thrift_client:call(C6, testException, ["Xception"])), R7.
-{exception,{xception,1001,<<"Xception">>}}
+125> catch thrift_client:call(C, testException, ["Xception"]).
+{xception,1001,"This is an Xception"}
+126> thrift_client:call(C, testException, ["Xception"]).
+
+=ERROR REPORT==== 24-Feb-2008::23:00:23 ===
+Error in process <0.269.0> with exit value: {{nocatch,{xception,1001,"This is an
+ Xception"}},[{thrift_client,call,3},{erl_eval,do_apply,5},{shell,exprs,6},{shel
+l,eval_loop,3}]}
+
+** exited: {{nocatch,{xception,1001,"This is an Xception"}},
+ [{thrift_client,call,3},
+ {erl_eval,do_apply,5},
+ {shell,exprs,6},
+ {shell,eval_loop,3}]} **
View
@@ -25,6 +25,7 @@ OS_TYPE=${shell uname}
# MHOST is the host where this Makefile runs.
MHOST=${shell hostname -s}
+ERL_COMPILE_FLAGS+=-W0
# The location of the erlang runtime system.
ifndef ERL_RUN_TOP
@@ -18,7 +18,7 @@
%%
-ifndef(THRIFT_PROTOCOL_INCLUDED).
--define(THRIFT_PROTOCOL_INCLUDED, true).
+-define(THRIFT_PROTOCOL_INCLUDED, yea).
-record(protocol_message_begin, {name, type, seqid}).
-record(protocol_struct_begin, {name}).
@@ -27,40 +27,5 @@
-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
- .
--type tprot_cont_tag() :: {list, _Type}
- | {map, _KType, _VType}
- | {set, _Type}
- .
-
-endif.
View
@@ -27,7 +27,6 @@ INSTALL_DST = $(ERLANG_OTP)/lib/$(APP_NAME)-$(VSN)
MODULES = $(shell find . -name \*.erl | sed 's:^\./::' | sed 's/\.erl//')
MODULES_STRING_LIST = $(shell find . -name \*.erl | sed 's:^\./:":' | sed 's/\.erl/",/')
-BEHAV_MODULES = $(shell find . -name \*.erl | xargs grep -l behaviour_info | sed 's:^\./::' | sed 's/\.erl//')
HRL_FILES=
INTERNAL_HRL_FILES= $(APP_NAME).hrl
@@ -44,8 +43,7 @@ APP_TARGET= $(EBIN)/$(APP_FILE)
APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
BEAMS= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
-BEHAV_BEAMS= $(BEHAV_MODULES:%=$(EBIN)/%.$(EMULATOR))
-TARGET_FILES= $(BEHAV_BEAMS) $(BEAMS) $(APP_TARGET) $(APPUP_TARGET)
+TARGET_FILES= $(BEAMS) $(APP_TARGET) $(APPUP_TARGET)
WEB_TARGET=/var/yaws/www/$(APP_NAME)
@@ -55,8 +53,7 @@ WEB_TARGET=/var/yaws/www/$(APP_NAME)
ERL_FLAGS +=
ERL_INCLUDE = -I../include -I../../fslib/include -I../../system_status/include
-ERL_BEHAV_PATH = -pz ../ebin
-ERL_COMPILE_FLAGS += $(ERL_INCLUDE) $(ERL_BEHAV_PATH)
+ERL_COMPILE_FLAGS += $(ERL_INCLUDE)
# ----------------------------------------------------
# Targets
@@ -17,15 +17,10 @@
%% under the License.
%%
-%% Signature specifications for transport implementations.
+-module(test_handler).
--ifndef(THRIFT_TRANSPORT_BEHAVIOUR_INCLUDED).
--define(THRIFT_TRANSPORT_BEHAVIOUR_INCLUDED, true).
+-export([handle_function/2]).
--spec write(state(), iolist() | binary()) -> {state(), ok | {error, _Reason}}.
--spec read(state(), non_neg_integer()) -> {state(), {ok, binary()} | {error, _Reason}}.
--spec flush(state()) -> {state(), ok | {error, _Reason}}.
--spec close(state()) -> {state(), ok | {error, _Reason}}.
-
-
--endif.
+handle_function(add, Params = {A, B}) ->
+ io:format("Got params: ~p~n", [Params]),
+ {reply, A + B}.
@@ -17,21 +17,13 @@
%% under the License.
%%
-%% Signature specifications for protocol implementations.
+-module(test_service).
+%
+% Test service definition
--ifndef(THRIFT_PROTOCOL_BEHAVIOUR_INCLUDED).
--define(THRIFT_PROTOCOL_BEHAVIOUR_INCLUDED, true).
+-export([function_info/2]).
--spec flush_transport(state()) -> {state(), ok | {error, _Reason}}.
--spec close_transport(state()) -> {state(), ok | {error, _Reason}}.
-
--spec write(state(), any()) -> {state(), ok | {error, _Reason}}.
-
-%% NOTE: Keep this in sync with thrift_protocol:read and read_specific.
--spec read
- (state(), tprot_empty_tag()) -> {state(), ok | {error, _Reason}};
- (state(), tprot_header_tag()) -> {state(), tprot_header_val() | {error, _Reason}};
- (state(), tprot_data_tag()) -> {state(), {ok, any()} | {error, _Reason}}.
-
-
--endif.
+function_info(add, params_type) ->
+ {struct, [{1, i32},
+ {2, i32}]};
+function_info(add, reply_type) -> i32.
@@ -29,35 +29,30 @@
%% State
-record(b64_transport, {wrapped}).
--type state() :: #b64_transport{}.
--include("thrift_transport_behaviour.hrl").
new(Wrapped) ->
State = #b64_transport{wrapped = Wrapped},
thrift_transport:new(?MODULE, State).
-write(This = #b64_transport{wrapped = Wrapped}, Data) ->
- {NewWrapped, Result} = thrift_transport:write(Wrapped, base64:encode(iolist_to_binary(Data))),
- {This#b64_transport{wrapped = NewWrapped}, Result}.
+write(#b64_transport{wrapped = Wrapped}, Data) ->
+ thrift_transport:write(Wrapped, base64:encode(iolist_to_binary(Data))).
%% base64 doesn't support reading quite yet since it would involve
%% nasty buffering and such
-read(This = #b64_transport{}, _Data) ->
- {This, {error, no_reads_allowed}}.
+read(#b64_transport{wrapped = Wrapped}, Data) ->
+ {error, no_reads_allowed}.
-flush(This = #b64_transport{wrapped = Wrapped0}) ->
- {Wrapped1, ok} = thrift_transport:write(Wrapped0, <<"\n">>),
- {Wrapped2, ok} = thrift_transport:flush(Wrapped1),
- {This#b64_transport{wrapped = Wrapped2}, ok}.
+flush(#b64_transport{wrapped = Wrapped}) ->
+ thrift_transport:write(Wrapped, <<"\n">>),
+ thrift_transport:flush(Wrapped).
-close(This0) ->
- {This1 = #b64_transport{wrapped = Wrapped}, ok} = flush(This0),
- {NewWrapped, ok} = thrift_transport:close(Wrapped),
- {This1#b64_transport{wrapped = NewWrapped}, ok}.
+close(Me = #b64_transport{wrapped = Wrapped}) ->
+ flush(Me),
+ thrift_transport:close(Wrapped).
%%%% FACTORY GENERATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Oops, something went wrong.

0 comments on commit f32d0fb

Please sign in to comment.