Moving from govendor to dep, updated dependencies (#48)
* Moving from govendor to dep. * Making the pull request template more friendly. * Fixing akward space in PR template. * goimports run on whole project using ` goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./gen-go/*")` source of command: https://gist.github.com/bgentry/fd1ffef7dbde01857f66
This commit is contained in:
parent
9631aa3aab
commit
8d445c1c77
2186 changed files with 400410 additions and 352 deletions
8
vendor/git.apache.org/thrift.git/tutorial/erl/README.md
generated
vendored
Normal file
8
vendor/git.apache.org/thrift.git/tutorial/erl/README.md
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
To try things out, run
|
||||
|
||||
% ./server.sh
|
||||
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]
|
||||
|
||||
Eshell V5.8.1 (abort with ^G)
|
||||
> server:start().
|
||||
> client:t().
|
78
vendor/git.apache.org/thrift.git/tutorial/erl/client.erl
generated
vendored
Normal file
78
vendor/git.apache.org/thrift.git/tutorial/erl/client.erl
generated
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
%%
|
||||
%% Licensed to the Apache Software Foundation (ASF) under one
|
||||
%% or more contributor license agreements. See the NOTICE file
|
||||
%% distributed with this work for additional information
|
||||
%% regarding copyright ownership. The ASF licenses this file
|
||||
%% to you under the Apache License, Version 2.0 (the
|
||||
%% "License"); you may not use this file except in compliance
|
||||
%% with the License. You may obtain a copy of the License at
|
||||
%%
|
||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||
%%
|
||||
%% Unless required by applicable law or agreed to in writing,
|
||||
%% software distributed under the License is distributed on an
|
||||
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
%% KIND, either express or implied. See the License for the
|
||||
%% specific language governing permissions and limitations
|
||||
%% under the License.
|
||||
%%
|
||||
|
||||
-module(client).
|
||||
|
||||
-include("calculator_thrift.hrl").
|
||||
|
||||
-export([t/0]).
|
||||
|
||||
p(X) ->
|
||||
io:format("~p~n", [X]),
|
||||
ok.
|
||||
|
||||
t() ->
|
||||
Port = 9999,
|
||||
|
||||
{ok, Client0} = thrift_client_util:new("127.0.0.1",
|
||||
Port,
|
||||
calculator_thrift,
|
||||
[]),
|
||||
|
||||
{Client1, {ok, ok}} = thrift_client:call(Client0, ping, []),
|
||||
io:format("ping~n", []),
|
||||
|
||||
{Client2, {ok, Sum}} = thrift_client:call(Client1, add, [1, 1]),
|
||||
io:format("1+1=~p~n", [Sum]),
|
||||
|
||||
{Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
|
||||
io:format("1+4=~p~n", [Sum1]),
|
||||
|
||||
Work = #work{op=?tutorial_Operation_SUBTRACT,
|
||||
num1=15,
|
||||
num2=10},
|
||||
{Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
|
||||
io:format("15-10=~p~n", [Diff]),
|
||||
|
||||
{Client5, {ok, Log}} = thrift_client:call(Client4, getStruct, [1]),
|
||||
io:format("Log: ~p~n", [Log]),
|
||||
|
||||
Client6 =
|
||||
try
|
||||
Work1 = #work{op=?tutorial_Operation_DIVIDE,
|
||||
num1=1,
|
||||
num2=0},
|
||||
{ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, [2, Work1]),
|
||||
|
||||
io:format("LAME: exception handling is broken~n", []),
|
||||
ClientS1
|
||||
catch
|
||||
throw:{ClientS2, Z} ->
|
||||
io:format("Got exception where expecting - the " ++
|
||||
"following is NOT a problem!!!~n"),
|
||||
p(Z),
|
||||
ClientS2
|
||||
end,
|
||||
|
||||
|
||||
{Client7, {ok, ok}} = thrift_client:call(Client6, zip, []),
|
||||
io:format("zip~n", []),
|
||||
|
||||
{_Client8, ok} = thrift_client:close(Client7),
|
||||
ok.
|
1
vendor/git.apache.org/thrift.git/tutorial/erl/client.sh
generated
vendored
Symbolic link
1
vendor/git.apache.org/thrift.git/tutorial/erl/client.sh
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
server.sh
|
89
vendor/git.apache.org/thrift.git/tutorial/erl/json_client.erl
generated
vendored
Normal file
89
vendor/git.apache.org/thrift.git/tutorial/erl/json_client.erl
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
%%
|
||||
%% Licensed to the Apache Software Foundation (ASF) under one
|
||||
%% or more contributor license agreements. See the NOTICE file
|
||||
%% distributed with this work for additional information
|
||||
%% regarding copyright ownership. The ASF licenses this file
|
||||
%% to you under the Apache License, Version 2.0 (the
|
||||
%% "License"); you may not use this file except in compliance
|
||||
%% with the License. You may obtain a copy of the License at
|
||||
%%
|
||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||
%%
|
||||
%% Unless required by applicable law or agreed to in writing,
|
||||
%% software distributed under the License is distributed on an
|
||||
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
%% KIND, either express or implied. See the License for the
|
||||
%% specific language governing permissions and limitations
|
||||
%% under the License.
|
||||
%%
|
||||
%% The JSON protocol over HTTP implementation was created by
|
||||
%% Peter Neumark <neumark.peter@gmail.com> based on
|
||||
%% the binary protocol + socket tutorial. Use with the same server
|
||||
%% that the Javascript tutorial uses!
|
||||
|
||||
-module(json_client).
|
||||
|
||||
-include("calculator_thrift.hrl").
|
||||
|
||||
-export([t/0]).
|
||||
|
||||
%% Client constructor for the http transports
|
||||
%% with the json protocol
|
||||
new_client(Host, Path, Service, _Options) ->
|
||||
{ProtoOpts, TransOpts} = {[],[]},
|
||||
TransportFactory = fun() -> thrift_http_transport:new(Host, Path, TransOpts) end,
|
||||
{ok, ProtocolFactory} = thrift_json_protocol:new_protocol_factory(
|
||||
TransportFactory, ProtoOpts),
|
||||
{ok, Protocol} = ProtocolFactory(),
|
||||
thrift_client:new(Protocol, Service).
|
||||
|
||||
p(X) ->
|
||||
io:format("~p~n", [X]),
|
||||
ok.
|
||||
|
||||
t() ->
|
||||
inets:start(),
|
||||
{ok, Client0} = new_client("127.0.0.1:8088", "/thrift/service/tutorial/",
|
||||
calculator_thrift,
|
||||
[]),
|
||||
{Client1, {ok, ok}} = thrift_client:call(Client0, ping, []),
|
||||
io:format("ping~n", []),
|
||||
|
||||
{Client2, {ok, Sum}} = thrift_client:call(Client1, add, [1, 1]),
|
||||
io:format("1+1=~p~n", [Sum]),
|
||||
|
||||
{Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
|
||||
io:format("1+4=~p~n", [Sum1]),
|
||||
|
||||
Work = #work{op=?tutorial_Operation_SUBTRACT,
|
||||
num1=15,
|
||||
num2=10},
|
||||
{Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
|
||||
io:format("15-10=~p~n", [Diff]),
|
||||
|
||||
{Client5, {ok, Log}} = thrift_client:call(Client4, getStruct, [1]),
|
||||
io:format("Log: ~p~n", [Log]),
|
||||
|
||||
Client6 =
|
||||
try
|
||||
Work1 = #work{op=?tutorial_Operation_DIVIDE,
|
||||
num1=1,
|
||||
num2=0},
|
||||
{ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, [2, Work1]),
|
||||
|
||||
io:format("LAME: exception handling is broken~n", []),
|
||||
ClientS1
|
||||
catch
|
||||
throw:{ClientS2, Z} ->
|
||||
io:format("Got exception where expecting - the " ++
|
||||
"following is NOT a problem!!!~n"),
|
||||
p(Z),
|
||||
ClientS2
|
||||
end,
|
||||
|
||||
|
||||
{Client7, {ok, ok}} = thrift_client:call(Client6, zip, []),
|
||||
io:format("zip~n", []),
|
||||
|
||||
{_Client8, ok} = thrift_client:close(Client7),
|
||||
ok.
|
82
vendor/git.apache.org/thrift.git/tutorial/erl/server.erl
generated
vendored
Normal file
82
vendor/git.apache.org/thrift.git/tutorial/erl/server.erl
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
%%
|
||||
%% Licensed to the Apache Software Foundation (ASF) under one
|
||||
%% or more contributor license agreements. See the NOTICE file
|
||||
%% distributed with this work for additional information
|
||||
%% regarding copyright ownership. The ASF licenses this file
|
||||
%% to you under the Apache License, Version 2.0 (the
|
||||
%% "License"); you may not use this file except in compliance
|
||||
%% with the License. You may obtain a copy of the License at
|
||||
%%
|
||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||
%%
|
||||
%% Unless required by applicable law or agreed to in writing,
|
||||
%% software distributed under the License is distributed on an
|
||||
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
%% KIND, either express or implied. See the License for the
|
||||
%% specific language governing permissions and limitations
|
||||
%% under the License.
|
||||
%%
|
||||
|
||||
-module(server).
|
||||
|
||||
-include("calculator_thrift.hrl").
|
||||
|
||||
-export([start/0, start/1, handle_function/2,
|
||||
stop/1, ping/0, add/2, calculate/2, getStruct/1, zip/0]).
|
||||
|
||||
debug(Format, Data) ->
|
||||
error_logger:info_msg(Format, Data).
|
||||
|
||||
ping() ->
|
||||
debug("ping()",[]),
|
||||
ok.
|
||||
|
||||
add(N1, N2) ->
|
||||
debug("add(~p,~p)",[N1,N2]),
|
||||
N1+N2.
|
||||
|
||||
calculate(Logid, Work) ->
|
||||
{ Op, Num1, Num2 } = { Work#work.op, Work#work.num1, Work#work.num2 },
|
||||
debug("calculate(~p, {~p,~p,~p})", [Logid, Op, Num1, Num2]),
|
||||
case Op of
|
||||
?tutorial_Operation_ADD -> Num1 + Num2;
|
||||
?tutorial_Operation_SUBTRACT -> Num1 - Num2;
|
||||
?tutorial_Operation_MULTIPLY -> Num1 * Num2;
|
||||
|
||||
?tutorial_Operation_DIVIDE when Num2 == 0 ->
|
||||
throw(#invalidOperation{whatOp=Op, why="Cannot divide by 0"});
|
||||
?tutorial_Operation_DIVIDE ->
|
||||
Num1 div Num2;
|
||||
|
||||
_Else ->
|
||||
throw(#invalidOperation{whatOp=Op, why="Invalid operation"})
|
||||
end.
|
||||
|
||||
getStruct(Key) ->
|
||||
debug("getStruct(~p)", [Key]),
|
||||
#sharedStruct{key=Key, value="RARG"}.
|
||||
|
||||
zip() ->
|
||||
debug("zip", []),
|
||||
ok.
|
||||
|
||||
%%
|
||||
|
||||
start() ->
|
||||
start(9999).
|
||||
|
||||
start(Port) ->
|
||||
Handler = ?MODULE,
|
||||
thrift_socket_server:start([{handler, Handler},
|
||||
{service, calculator_thrift},
|
||||
{port, Port},
|
||||
{name, tutorial_server}]).
|
||||
|
||||
stop(Server) ->
|
||||
thrift_socket_server:stop(Server).
|
||||
|
||||
handle_function(Function, Args) when is_atom(Function), is_tuple(Args) ->
|
||||
case apply(?MODULE, Function, tuple_to_list(Args)) of
|
||||
ok -> ok;
|
||||
Reply -> {reply, Reply}
|
||||
end.
|
37
vendor/git.apache.org/thrift.git/tutorial/erl/server.sh
generated
vendored
Executable file
37
vendor/git.apache.org/thrift.git/tutorial/erl/server.sh
generated
vendored
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
ERL_THRIFT=../../lib/erl
|
||||
|
||||
if ! [ -d ${ERL_THRIFT}/ebin ]; then
|
||||
echo "Please build the Thrift library by running \`make' in ${ERL_THRIFT}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ -d gen-erl ]; then
|
||||
../../compiler/cpp/thrift -r --gen erl ../tutorial.thrift
|
||||
fi
|
||||
|
||||
|
||||
erlc -I ${ERL_THRIFT}/include -I ${ERL_THRIFT}/ebin \
|
||||
-I gen-erl -o gen-erl gen-erl/*.erl &&
|
||||
erlc -I ${ERL_THRIFT}/include -I gen-erl *.erl &&
|
||||
erl +K true -pa ${ERL_THRIFT}/ebin -pa gen-erl
|
Loading…
Add table
Add a link
Reference in a new issue