Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
56c51296
Commit
56c51296
authored
10 years ago
by
vjpai
Browse files
Options
Downloads
Patches
Plain Diff
Rename Async methods from generator to avoid naming conflicts to
bind and other functions
parent
95a34efc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/compiler/cpp_generator.cc
+8
-8
8 additions, 8 deletions
src/compiler/cpp_generator.cc
test/cpp/end2end/async_end2end_test.cc
+8
-8
8 additions, 8 deletions
test/cpp/end2end/async_end2end_test.cc
test/cpp/qps/client_async.cc
+4
-5
4 additions, 5 deletions
test/cpp/qps/client_async.cc
with
20 additions
and
21 deletions
src/compiler/cpp_generator.cc
+
8
−
8
View file @
56c51296
...
...
@@ -186,7 +186,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
printer
->
Print
(
*
vars
,
"std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
"$Method$(::grpc::ClientContext* context, "
"
Async
$Method$(::grpc::ClientContext* context, "
"const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag);
\n
"
);
}
else
if
(
ClientOnlyStreaming
(
method
))
{
...
...
@@ -196,7 +196,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
"::grpc::ClientContext* context, $Response$* response);
\n
"
);
printer
->
Print
(
*
vars
,
"std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> $Method$("
"std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>
Async
$Method$("
"::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag);
\n
"
);
}
else
if
(
ServerOnlyStreaming
(
method
))
{
...
...
@@ -206,7 +206,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
"::grpc::ClientContext* context, const $Request$& request);
\n
"
);
printer
->
Print
(
*
vars
,
"std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> $Method$("
"std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>>
Async
$Method$("
"::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag);
\n
"
);
}
else
if
(
BidiStreaming
(
method
))
{
...
...
@@ -217,7 +217,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
printer
->
Print
(
*
vars
,
"std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
"$Request$, $Response$>> "
"$Method$(::grpc::ClientContext* context, "
"
Async
$Method$(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq, void* tag);
\n
"
);
}
}
...
...
@@ -390,7 +390,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
printer
->
Print
(
*
vars
,
"std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
"$Service$::Stub::$Method$(::grpc::ClientContext* context, "
"$Service$::Stub::
Async
$Method$(::grpc::ClientContext* context, "
"const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) {
\n
"
);
printer
->
Print
(
*
vars
,
...
...
@@ -416,7 +416,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
"}
\n\n
"
);
printer
->
Print
(
*
vars
,
"std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> "
"$Service$::Stub::$Method$("
"$Service$::Stub::
Async
$Method$("
"::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag) {
\n
"
);
printer
->
Print
(
*
vars
,
...
...
@@ -443,7 +443,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
"}
\n\n
"
);
printer
->
Print
(
*
vars
,
"std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> "
"$Service$::Stub::$Method$("
"$Service$::Stub::
Async
$Method$("
"::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) {
\n
"
);
printer
->
Print
(
*
vars
,
...
...
@@ -471,7 +471,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
printer
->
Print
(
*
vars
,
"std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
"$Request$, $Response$>> "
"$Service$::Stub::$Method$(::grpc::ClientContext* context, "
"$Service$::Stub::
Async
$Method$(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq, void* tag) {
\n
"
);
printer
->
Print
(
*
vars
,
" return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
...
...
This diff is collapsed.
Click to expand it.
test/cpp/end2end/async_end2end_test.cc
+
8
−
8
View file @
56c51296
...
...
@@ -136,7 +136,7 @@ class AsyncEnd2endTest : public ::testing::Test {
send_request
.
set_message
(
"Hello"
);
std
::
unique_ptr
<
ClientAsyncResponseReader
<
EchoResponse
>
>
response_reader
(
stub_
->
Echo
(
response_reader
(
stub_
->
Async
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
service_
.
RequestEcho
(
...
...
@@ -191,7 +191,7 @@ TEST_F(AsyncEnd2endTest, SimpleClientStreaming) {
send_request
.
set_message
(
"Hello"
);
std
::
unique_ptr
<
ClientAsyncWriter
<
EchoRequest
>
>
cli_stream
(
stub_
->
RequestStream
(
&
cli_ctx
,
&
recv_response
,
&
cli_cq_
,
tag
(
1
)));
stub_
->
Async
RequestStream
(
&
cli_ctx
,
&
recv_response
,
&
cli_cq_
,
tag
(
1
)));
service_
.
RequestRequestStream
(
&
srv_ctx
,
&
srv_stream
,
&
srv_cq_
,
tag
(
2
));
...
...
@@ -245,7 +245,7 @@ TEST_F(AsyncEnd2endTest, SimpleServerStreaming) {
send_request
.
set_message
(
"Hello"
);
std
::
unique_ptr
<
ClientAsyncReader
<
EchoResponse
>
>
cli_stream
(
stub_
->
ResponseStream
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
stub_
->
Async
ResponseStream
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
service_
.
RequestResponseStream
(
&
srv_ctx
,
&
recv_request
,
&
srv_stream
,
&
srv_cq_
,
tag
(
2
));
...
...
@@ -296,7 +296,7 @@ TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) {
send_request
.
set_message
(
"Hello"
);
std
::
unique_ptr
<
ClientAsyncReaderWriter
<
EchoRequest
,
EchoResponse
>
>
cli_stream
(
stub_
->
BidiStream
(
&
cli_ctx
,
&
cli_cq_
,
tag
(
1
)));
cli_stream
(
stub_
->
Async
BidiStream
(
&
cli_ctx
,
&
cli_cq_
,
tag
(
1
)));
service_
.
RequestBidiStream
(
&
srv_ctx
,
&
srv_stream
,
&
srv_cq_
,
tag
(
2
));
...
...
@@ -355,7 +355,7 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) {
cli_ctx
.
AddMetadata
(
meta2
.
first
,
meta2
.
second
);
std
::
unique_ptr
<
ClientAsyncResponseReader
<
EchoResponse
>
>
response_reader
(
stub_
->
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
stub_
->
Async
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
service_
.
RequestEcho
(
&
srv_ctx
,
&
recv_request
,
&
response_writer
,
&
srv_cq_
,
tag
(
2
));
...
...
@@ -397,7 +397,7 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) {
std
::
pair
<
grpc
::
string
,
grpc
::
string
>
meta2
(
"key2"
,
"val2"
);
std
::
unique_ptr
<
ClientAsyncResponseReader
<
EchoResponse
>
>
response_reader
(
stub_
->
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
stub_
->
Async
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
service_
.
RequestEcho
(
&
srv_ctx
,
&
recv_request
,
&
response_writer
,
&
srv_cq_
,
tag
(
2
));
...
...
@@ -445,7 +445,7 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) {
std
::
pair
<
grpc
::
string
,
grpc
::
string
>
meta2
(
"key2"
,
"val2"
);
std
::
unique_ptr
<
ClientAsyncResponseReader
<
EchoResponse
>
>
response_reader
(
stub_
->
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
stub_
->
Async
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
service_
.
RequestEcho
(
&
srv_ctx
,
&
recv_request
,
&
response_writer
,
&
srv_cq_
,
tag
(
2
));
...
...
@@ -501,7 +501,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) {
cli_ctx
.
AddMetadata
(
meta2
.
first
,
meta2
.
second
);
std
::
unique_ptr
<
ClientAsyncResponseReader
<
EchoResponse
>
>
response_reader
(
stub_
->
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
stub_
->
Async
Echo
(
&
cli_ctx
,
send_request
,
&
cli_cq_
,
tag
(
1
)));
service_
.
RequestEcho
(
&
srv_ctx
,
&
recv_request
,
&
response_writer
,
&
srv_cq_
,
tag
(
2
));
...
...
This diff is collapsed.
Click to expand it.
test/cpp/qps/client_async.cc
+
4
−
5
View file @
56c51296
...
...
@@ -109,9 +109,9 @@ static double now() {
class
ClientRpcContextUnaryImpl
:
public
ClientRpcContext
{
public:
ClientRpcContextUnaryImpl
(
const
RequestType
&
req
,
std
::
function
<
grpc
::
ClientAsyncResponseReader
<
ResponseType
>
*
(
grpc
::
ClientContext
*
,
const
RequestType
&
,
void
*
)
>
start_req
,
std
::
function
<
std
::
unique_ptr
<
grpc
::
ClientAsyncResponseReader
<
ResponseType
>
>
(
grpc
::
ClientContext
*
,
const
RequestType
&
,
void
*
)
>
start_req
,
std
::
function
<
void
(
grpc
::
Status
,
ResponseType
*
)
>
on_done
)
:
context_
(),
req_
(
req
),
response_
(),
next_state_
(
&
ClientRpcContextUnaryImpl
::
ReqSent
),
...
...
@@ -226,8 +226,7 @@ static void RunTest(const int client_threads, const int client_channels,
TestService
::
Stub
*
stub
=
channels
[
channel_num
].
get_stub
();
grpc
::
ClientContext
context
;
auto
start_req
=
std
::
bind
(
static_cast
<
grpc
::
ClientAsyncResponseReader
<
SimpleResponse
>*
(
TestService
::
Stub
::*
)(
grpc
::
ClientContext
*
,
const
SimpleRequest
&
,
grpc
::
CompletionQueue
*
,
void
*
)
>
(
&
TestService
::
Stub
::
UnaryCall
),
auto
start_req
=
std
::
bind
(
&
TestService
::
Stub
::
AsyncUnaryCall
,
stub
,
_1
,
_2
,
&
cli_cq
,
_3
);
new
ClientRpcContextUnaryImpl
<
SimpleRequest
,
SimpleResponse
>
(
request
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment