|
|
@ -83,7 +83,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { |
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, |
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, |
|
|
|
CompletionQueue*)> |
|
|
|
CompletionQueue*)> |
|
|
|
start_req, |
|
|
|
start_req, |
|
|
|
std::function<void(grpc::Status, ResponseType*)> on_done) |
|
|
|
std::function<void(grpc::Status, ResponseType*, HistogramEntry*)> on_done) |
|
|
|
: context_(), |
|
|
|
: context_(), |
|
|
|
stub_(stub), |
|
|
|
stub_(stub), |
|
|
|
cq_(nullptr), |
|
|
|
cq_(nullptr), |
|
|
@ -113,7 +113,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
case State::RESP_DONE: |
|
|
|
case State::RESP_DONE: |
|
|
|
entry->set_value((UsageTimer::Now() - start_) * 1e9); |
|
|
|
entry->set_value((UsageTimer::Now() - start_) * 1e9); |
|
|
|
callback_(status_, &response_); |
|
|
|
callback_(status_, &response_, entry); |
|
|
|
next_state_ = State::INVALID; |
|
|
|
next_state_ = State::INVALID; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
default: |
|
|
|
default: |
|
|
@ -135,7 +135,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { |
|
|
|
ResponseType response_; |
|
|
|
ResponseType response_; |
|
|
|
enum State { INVALID, READY, RESP_DONE }; |
|
|
|
enum State { INVALID, READY, RESP_DONE }; |
|
|
|
State next_state_; |
|
|
|
State next_state_; |
|
|
|
std::function<void(grpc::Status, ResponseType*)> callback_; |
|
|
|
std::function<void(grpc::Status, ResponseType*, HistogramEntry*)> callback_; |
|
|
|
std::function<gpr_timespec()> next_issue_; |
|
|
|
std::function<gpr_timespec()> next_issue_; |
|
|
|
std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( |
|
|
|
std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( |
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, |
|
|
|
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, |
|
|
@ -289,7 +289,10 @@ class AsyncUnaryClient GRPC_FINAL |
|
|
|
~AsyncUnaryClient() GRPC_OVERRIDE {} |
|
|
|
~AsyncUnaryClient() GRPC_OVERRIDE {} |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
static void CheckDone(grpc::Status s, SimpleResponse* response) {} |
|
|
|
static void CheckDone(grpc::Status s, SimpleResponse* response, |
|
|
|
|
|
|
|
HistogramEntry* entry) { |
|
|
|
|
|
|
|
entry->set_status(s.error_code()); |
|
|
|
|
|
|
|
} |
|
|
|
static std::unique_ptr<grpc::ClientAsyncResponseReader<SimpleResponse>> |
|
|
|
static std::unique_ptr<grpc::ClientAsyncResponseReader<SimpleResponse>> |
|
|
|
StartReq(BenchmarkService::Stub* stub, grpc::ClientContext* ctx, |
|
|
|
StartReq(BenchmarkService::Stub* stub, grpc::ClientContext* ctx, |
|
|
|
const SimpleRequest& request, CompletionQueue* cq) { |
|
|
|
const SimpleRequest& request, CompletionQueue* cq) { |
|
|
|