|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
/*
|
|
|
|
|
* |
|
|
|
|
* Copyright 2015, Google Inc. |
|
|
|
|
* Copyright 2015-2016, Google Inc. |
|
|
|
|
* All rights reserved. |
|
|
|
|
* |
|
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
|
|
@ -93,8 +93,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { |
|
|
|
|
std::function< |
|
|
|
|
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( |
|
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, |
|
|
|
|
CompletionQueue*)> |
|
|
|
|
start_req, |
|
|
|
|
CompletionQueue*)> start_req, |
|
|
|
|
std::function<void(grpc::Status, ResponseType*)> on_done) |
|
|
|
|
: ClientRpcContext(channel_id), |
|
|
|
|
context_(), |
|
|
|
@ -140,8 +139,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { |
|
|
|
|
std::function<void(grpc::Status, ResponseType*)> callback_; |
|
|
|
|
std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( |
|
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, |
|
|
|
|
CompletionQueue*)> |
|
|
|
|
start_req_; |
|
|
|
|
CompletionQueue*)> start_req_; |
|
|
|
|
grpc::Status status_; |
|
|
|
|
double start_; |
|
|
|
|
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>> |
|
|
|
@ -160,12 +158,11 @@ class AsyncClient : public ClientImpl<StubType, RequestType> { |
|
|
|
|
using Client::closed_loop_; |
|
|
|
|
using ClientImpl<StubType, RequestType>::channels_; |
|
|
|
|
using ClientImpl<StubType, RequestType>::request_; |
|
|
|
|
AsyncClient( |
|
|
|
|
const ClientConfig& config, |
|
|
|
|
std::function<ClientRpcContext*(int, StubType*, const RequestType&)> |
|
|
|
|
setup_ctx, |
|
|
|
|
std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> |
|
|
|
|
create_stub) |
|
|
|
|
AsyncClient(const ClientConfig& config, |
|
|
|
|
std::function<ClientRpcContext*(int, StubType*, |
|
|
|
|
const RequestType&)> setup_ctx, |
|
|
|
|
std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> |
|
|
|
|
create_stub) |
|
|
|
|
: ClientImpl<StubType, RequestType>(config, create_stub), |
|
|
|
|
channel_lock_(new std::mutex[config.client_channels()]), |
|
|
|
|
contexts_(config.client_channels()), |
|
|
|
@ -394,8 +391,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { |
|
|
|
|
std::function<std::unique_ptr< |
|
|
|
|
grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( |
|
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, |
|
|
|
|
void*)> |
|
|
|
|
start_req, |
|
|
|
|
void*)> start_req, |
|
|
|
|
std::function<void(grpc::Status, ResponseType*)> on_done) |
|
|
|
|
: ClientRpcContext(channel_id), |
|
|
|
|
context_(), |
|
|
|
@ -447,10 +443,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { |
|
|
|
|
ResponseType response_; |
|
|
|
|
bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*); |
|
|
|
|
std::function<void(grpc::Status, ResponseType*)> callback_; |
|
|
|
|
std::function<std::unique_ptr< |
|
|
|
|
grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( |
|
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)> |
|
|
|
|
start_req_; |
|
|
|
|
std::function< |
|
|
|
|
std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( |
|
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, |
|
|
|
|
void*)> start_req_; |
|
|
|
|
grpc::Status status_; |
|
|
|
|
double start_; |
|
|
|
|
std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>> |
|
|
|
@ -494,8 +490,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { |
|
|
|
|
int channel_id, grpc::GenericStub* stub, const ByteBuffer& req, |
|
|
|
|
std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( |
|
|
|
|
grpc::GenericStub*, grpc::ClientContext*, |
|
|
|
|
const grpc::string& method_name, CompletionQueue*, void*)> |
|
|
|
|
start_req, |
|
|
|
|
const grpc::string& method_name, CompletionQueue*, void*)> start_req, |
|
|
|
|
std::function<void(grpc::Status, ByteBuffer*)> on_done) |
|
|
|
|
: ClientRpcContext(channel_id), |
|
|
|
|
context_(), |
|
|
|
@ -552,8 +547,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { |
|
|
|
|
std::function<void(grpc::Status, ByteBuffer*)> callback_; |
|
|
|
|
std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( |
|
|
|
|
grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, |
|
|
|
|
CompletionQueue*, void*)> |
|
|
|
|
start_req_; |
|
|
|
|
CompletionQueue*, void*)> start_req_; |
|
|
|
|
grpc::Status status_; |
|
|
|
|
double start_; |
|
|
|
|
std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_; |
|
|
|
@ -605,4 +599,4 @@ std::unique_ptr<Client> CreateGenericAsyncStreamingClient( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} // namespace testing
|
|
|
|
|
} // namespace grpc
|
|
|
|
|
} // namespace grpc
|