You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "guanyun (Jira)" <ji...@apache.org> on 2019/12/08 13:34:03 UTC

[jira] [Created] (HBASE-23467) CLONE - [C++] Make RespConverter work with RawAsyncTableImpl

guanyun created HBASE-23467:
-------------------------------

             Summary: CLONE - [C++] Make RespConverter work with RawAsyncTableImpl
                 Key: HBASE-23467
                 URL: https://issues.apache.org/jira/browse/HBASE-23467
             Project: HBase
          Issue Type: Sub-task
            Reporter: guanyun
            Assignee: Enis Soztutar
             Fix For: HBASE-14850
         Attachments: hbase-17727-v1.patch

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
(v8.3.4#803005)