[ https://issues.apache.org/jira/browse/HBASE-17727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xiaobing Zhou updated HBASE-17727: ---------------------------------- Description: This is a follow up work of HBASE-17465. There's a problem to dereference instance of RpcCallback when it's passed as function argument. {code} template<typename R, typename S> using RespConverter = std::function<R(const S&)>; {code} {code} template<typename REQ, typename PREQ, typename PRESP, typename RESP> folly::Future<RESP> Call( std::shared_ptr<hbase::RpcClient> rpc_client, std::shared_ptr<HBaseRpcController> controller, std::shared_ptr<RegionLocation> loc, const REQ& req, const ReqConverter<std::unique_ptr<PREQ>, REQ, std::string>& req_converter, const hbase::RpcCall<PREQ, PRESP, hbase::RpcClient>& rpc_call, const RespConverter<std::unique_ptr<RESP>, PRESP>& resp_converter) { rpc_call( rpc_client, loc, controller, std::move(req_converter(req, loc->region_name()))) .then([&, this](std::unique_ptr<PRESP> presp) { // std::unique_ptr<hbase::Result> result = resp_converter(presp); std::unique_ptr<hbase::Result> result = hbase::ResponseConverter::FromGetResponse(*presp); promise_->setValue(std::move(*result)); }) .onError([this] (const std::exception& e) {promise_->setException(e);}); return promise_->getFuture(); } {code} was: This is a follow up work of HBASE-17465. There's a problem to dereference instance of RpcCallback when it's passed as function argument. {code} template<typename R, typename S> using RespConverter = std::function<R(const S&)>; {code} {code} template<typename REQ, typename PREQ, typename PRESP, typename RESP> folly::Future<RESP> Call( std::shared_ptr<hbase::RpcClient> rpc_client, std::shared_ptr<HBaseRpcController> controller, std::shared_ptr<RegionLocation> loc, const REQ& req, const ReqConverter<std::unique_ptr<PREQ>, REQ, std::string>& req_converter, const hbase::RpcCall<PREQ, PRESP, hbase::RpcClient>& rpc_call, const RespConverter<std::unique_ptr<RESP>, PRESP>& resp_converter) { rpc_call( rpc_client, loc, controller, std::move(req_converter(req, loc->region_name()))) .then([&, this](std::unique_ptr<PRESP> presp) { // std::unique_ptr<hbase::Result> result = resp_converter(presp); std::unique_ptr<hbase::Result> result = hbase::ResponseConverter::FromGetResponse(*presp); promise_->setValue(std::move(*result)); }) .onError([this] (const std::exception& e) {promise_->setException(e);}); return promise_->getFuture(); } {code} > [C++] Make RespConverter work with MockRawAsyncTableImpl > -------------------------------------------------------- > > Key: HBASE-17727 > URL: https://issues.apache.org/jira/browse/HBASE-17727 > Project: HBase > Issue Type: Sub-task > Reporter: Xiaobing Zhou > Assignee: Xiaobing Zhou > > This is a follow up work of HBASE-17465. > There's a problem to dereference instance of RpcCallback when it's passed as > function argument. > {code} > template<typename R, > typename S> > using RespConverter = std::function<R(const S&)>; > {code} > {code} > template<typename REQ, > typename PREQ, > typename PRESP, > typename RESP> > folly::Future<RESP> Call( > std::shared_ptr<hbase::RpcClient> rpc_client, > std::shared_ptr<HBaseRpcController> controller, > std::shared_ptr<RegionLocation> loc, > const REQ& req, > const ReqConverter<std::unique_ptr<PREQ>, REQ, std::string>& > req_converter, > const hbase::RpcCall<PREQ, PRESP, hbase::RpcClient>& rpc_call, > const RespConverter<std::unique_ptr<RESP>, PRESP>& resp_converter) { > rpc_call( > rpc_client, > loc, > controller, > std::move(req_converter(req, loc->region_name()))) > .then([&, this](std::unique_ptr<PRESP> presp) { > // std::unique_ptr<hbase::Result> result = resp_converter(presp); > std::unique_ptr<hbase::Result> result = > hbase::ResponseConverter::FromGetResponse(*presp); > promise_->setValue(std::move(*result)); > }) > .onError([this] (const std::exception& e) > {promise_->setException(e);}); > return promise_->getFuture(); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)