gorealis v2 refactor (#5)

* Changing default timeout for start maintenance.

* Upgrading dependencies to gorealis v2 and thrift  0.12.0

* Refactored to update to gorealis v2.
This commit is contained in:
Renan DelValle 2018-12-27 11:31:51 -08:00 committed by GitHub
parent ad4dd9606e
commit 6ab5c9334d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1335 changed files with 137431 additions and 61530 deletions

View file

@ -28,7 +28,7 @@ p(X) ->
ok.
t() ->
Port = 9999,
Port = 9090,
{ok, Client0} = thrift_client_util:new("127.0.0.1",
Port,
@ -44,7 +44,7 @@ t() ->
{Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
io:format("1+4=~p~n", [Sum1]),
Work = #work{op=?tutorial_Operation_SUBTRACT,
Work = #'Work'{op=?TUTORIAL_OPERATION_SUBTRACT,
num1=15,
num2=10},
{Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
@ -55,7 +55,7 @@ t() ->
Client6 =
try
Work1 = #work{op=?tutorial_Operation_DIVIDE,
Work1 = #'Work'{op=?TUTORIAL_OPERATION_DIVIDE,
num1=1,
num2=0},
{ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, [2, Work1]),

View file

@ -1 +0,0 @@
server.sh

37
vendor/git.apache.org/thrift.git/tutorial/erl/client.sh generated vendored Executable file
View 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

View file

@ -55,7 +55,7 @@ t() ->
{Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
io:format("1+4=~p~n", [Sum1]),
Work = #work{op=?tutorial_Operation_SUBTRACT,
Work = #'Work'{op=?TUTORIAL_OPERATION_SUBTRACT,
num1=15,
num2=10},
{Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
@ -66,7 +66,7 @@ t() ->
Client6 =
try
Work1 = #work{op=?tutorial_Operation_DIVIDE,
Work1 = #'Work'{op=?TUTORIAL_OPERATION_DIVIDE,
num1=1,
num2=0},
{ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, [2, Work1]),

View file

@ -36,25 +36,25 @@ add(N1, N2) ->
N1+N2.
calculate(Logid, Work) ->
{ Op, Num1, Num2 } = { Work#work.op, Work#work.num1, Work#work.num2 },
{ 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_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 ->
?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"})
throw(#'InvalidOperation'{whatOp=Op, why="Invalid operation"})
end.
getStruct(Key) ->
debug("getStruct(~p)", [Key]),
#sharedStruct{key=Key, value="RARG"}.
#'SharedStruct'{key=Key, value="RARG"}.
zip() ->
debug("zip", []),
@ -63,7 +63,7 @@ zip() ->
%%
start() ->
start(9999).
start(9090).
start(Port) ->
Handler = ?MODULE,

View file

@ -1,37 +0,0 @@
#!/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

1
vendor/git.apache.org/thrift.git/tutorial/erl/server.sh generated vendored Symbolic link
View file

@ -0,0 +1 @@
client.sh