This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new ba10906 [rpc] small cleanup on RemoteMethod, RpcContext
ba10906 is described below
commit ba10906449e682aacb0b52b1c7b34a23a0c2476f
Author: Alexey Serbin <[email protected]>
AuthorDate: Tue May 26 22:40:05 2020 -0700
[rpc] small cleanup on RemoteMethod, RpcContext
Avoid copying strings in methods
{RemoteMethod,RpcContext}::{method_name,service_name}.
Change-Id: I64531206b2eee8792372c989c48d430a7a62b865
Reviewed-on: http://gerrit.cloudera.org:8080/15989
Reviewed-by: Todd Lipcon <[email protected]>
Tested-by: Kudu Jenkins
---
src/kudu/rpc/remote_method.h | 4 ++--
src/kudu/rpc/rpc_context.cc | 4 ++--
src/kudu/rpc/rpc_context.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/kudu/rpc/remote_method.h b/src/kudu/rpc/remote_method.h
index b5e42ae..9c8ae72 100644
--- a/src/kudu/rpc/remote_method.h
+++ b/src/kudu/rpc/remote_method.h
@@ -30,8 +30,8 @@ class RemoteMethod {
public:
RemoteMethod() {}
RemoteMethod(std::string service_name, std::string method_name);
- std::string service_name() const { return service_name_; }
- std::string method_name() const { return method_name_; }
+ const std::string& service_name() const { return service_name_; }
+ const std::string& method_name() const { return method_name_; }
// Encode/decode to/from 'pb'.
void FromPB(const RemoteMethodPB& pb);
diff --git a/src/kudu/rpc/rpc_context.cc b/src/kudu/rpc/rpc_context.cc
index a65c137..d39f36b 100644
--- a/src/kudu/rpc/rpc_context.cc
+++ b/src/kudu/rpc/rpc_context.cc
@@ -176,11 +176,11 @@ std::string RpcContext::requestor_string() const {
call_->remote_address().ToString();
}
-std::string RpcContext::method_name() const {
+const std::string& RpcContext::method_name() const {
return call_->remote_method().method_name();
}
-std::string RpcContext::service_name() const {
+const std::string& RpcContext::service_name() const {
return call_->remote_method().service_name();
}
diff --git a/src/kudu/rpc/rpc_context.h b/src/kudu/rpc/rpc_context.h
index b1466ce..b507dcf 100644
--- a/src/kudu/rpc/rpc_context.h
+++ b/src/kudu/rpc/rpc_context.h
@@ -195,10 +195,10 @@ class RpcContext {
std::string requestor_string() const;
// Return the name of the RPC service method being called.
- std::string method_name() const;
+ const std::string& method_name() const;
// Return the name of the RPC service being called.
- std::string service_name() const;
+ const std::string& service_name() const;
const google::protobuf::Message *request_pb() const { return
request_pb_.get(); }
google::protobuf::Message *response_pb() const { return response_pb_.get(); }