hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [1/2] hbase git commit: HBASE-17741 [C++] rename some files to use (dash) instead of _
Date Tue, 07 Mar 2017 03:27:29 GMT
Repository: hbase
Updated Branches:
  refs/heads/HBASE-14850 c9f1ab074 -> 76919a74e


http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/request_converter-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/request_converter-test.cc b/hbase-native-client/core/request_converter-test.cc
deleted file mode 100644
index 84d5e8b..0000000
--- a/hbase-native-client/core/request_converter-test.cc
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "core/request_converter.h"
-
-#include <gtest/gtest.h>
-#include <limits>
-#include "connection/request.h"
-#include "core/get.h"
-#include "core/scan.h"
-
-using hbase::Get;
-using hbase::Scan;
-
-using hbase::pb::GetRequest;
-using hbase::pb::RegionSpecifier;
-using hbase::pb::RegionSpecifier_RegionSpecifierType;
-using hbase::pb::ScanRequest;
-
-TEST(RequestConverter, ToGet) {
-  std::string row_str = "row-test";
-  Get get(row_str);
-  get.AddFamily("family-1");
-  get.AddFamily("family-2");
-  get.AddFamily("family-3");
-  get.AddColumn("family-2", "qualifier-1");
-  get.AddColumn("family-2", "qualifier-2");
-  get.AddColumn("family-2", "qualifier-3");
-  get.SetCacheBlocks(false);
-  get.SetConsistency(hbase::pb::Consistency::TIMELINE);
-  get.SetMaxVersions(2);
-  get.SetTimeRange(10000, 20000);
-  std::string region_name("RegionName");
-
-  auto req = hbase::RequestConverter::ToGetRequest(get, region_name);
-  auto msg = std::static_pointer_cast<GetRequest>(req->req_msg());
-
-  // Tests whether the PB object is properly set or not.
-  ASSERT_TRUE(msg->has_region());
-  ASSERT_TRUE(msg->region().has_value());
-  EXPECT_EQ(msg->region().value(), region_name);
-
-  ASSERT_TRUE(msg->has_get());
-  EXPECT_EQ(msg->get().row(), row_str);
-  EXPECT_FALSE(msg->get().cache_blocks());
-  EXPECT_EQ(msg->get().consistency(), hbase::pb::Consistency::TIMELINE);
-  EXPECT_EQ(msg->get().max_versions(), 2);
-  EXPECT_EQ(msg->get().column_size(), 3);
-  for (int i = 0; i < msg->get().column_size(); ++i) {
-    EXPECT_EQ(msg->get().column(i).family(), "family-" + std::to_string(i + 1));
-    for (int j = 0; j < msg->get().column(i).qualifier_size(); ++j) {
-      EXPECT_EQ(msg->get().column(i).qualifier(j), "qualifier-" + std::to_string(j + 1));
-    }
-  }
-}
-
-TEST(RequestConverter, ToScan) {
-  std::string start_row("start-row");
-  std::string stop_row("stop-row");
-  hbase::Scan scan;
-  scan.AddFamily("family-1");
-  scan.AddFamily("family-2");
-  scan.AddFamily("family-3");
-  scan.AddColumn("family-2", "qualifier-1");
-  scan.AddColumn("family-2", "qualifier-2");
-  scan.AddColumn("family-2", "qualifier-3");
-  scan.SetReversed(true);
-  scan.SetStartRow(start_row);
-  scan.SetStopRow(stop_row);
-  scan.SetSmall(true);
-  scan.SetCaching(3);
-  scan.SetConsistency(hbase::pb::Consistency::TIMELINE);
-  scan.SetCacheBlocks(true);
-  scan.SetAllowPartialResults(true);
-  scan.SetLoadColumnFamiliesOnDemand(true);
-  scan.SetMaxVersions(5);
-  scan.SetTimeRange(10000, 20000);
-  std::string region_name("RegionName");
-
-  auto req = hbase::RequestConverter::ToScanRequest(scan, region_name);
-  auto msg = std::static_pointer_cast<ScanRequest>(req->req_msg());
-
-  // Tests whether the PB object is properly set or not.
-  ASSERT_TRUE(msg->has_region());
-  ASSERT_TRUE(msg->region().has_value());
-  EXPECT_EQ(msg->region().value(), region_name);
-
-  ASSERT_TRUE(msg->has_scan());
-  EXPECT_TRUE(msg->scan().reversed());
-  EXPECT_EQ(msg->scan().start_row(), start_row);
-  EXPECT_EQ(msg->scan().stop_row(), stop_row);
-  EXPECT_TRUE(msg->scan().small());
-  EXPECT_EQ(msg->scan().caching(), 3);
-  EXPECT_EQ(msg->scan().consistency(), hbase::pb::Consistency::TIMELINE);
-  EXPECT_TRUE(msg->scan().cache_blocks());
-  EXPECT_TRUE(msg->scan().allow_partial_results());
-  EXPECT_TRUE(msg->scan().load_column_families_on_demand());
-  EXPECT_EQ(msg->scan().max_versions(), 5);
-  EXPECT_EQ(msg->scan().max_result_size(), std::numeric_limits<uint64_t>::max());
-
-  EXPECT_EQ(msg->scan().column_size(), 3);
-  for (int i = 0; i < msg->scan().column_size(); ++i) {
-    EXPECT_EQ(msg->scan().column(i).family(), "family-" + std::to_string(i + 1));
-    for (int j = 0; j < msg->scan().column(i).qualifier_size(); ++j) {
-      EXPECT_EQ(msg->scan().column(i).qualifier(j), "qualifier-" + std::to_string(j +
1));
-    }
-  }
-  ASSERT_FALSE(msg->client_handles_partials());
-  ASSERT_FALSE(msg->client_handles_heartbeats());
-  ASSERT_FALSE(msg->track_scan_metrics());
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/request_converter.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/request_converter.cc b/hbase-native-client/core/request_converter.cc
deleted file mode 100644
index 149202e..0000000
--- a/hbase-native-client/core/request_converter.cc
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "core/request_converter.h"
-#include <utility>
-#include "if/Client.pb.h"
-
-using hbase::Request;
-using hbase::pb::GetRequest;
-using hbase::pb::RegionSpecifier;
-using hbase::pb::RegionSpecifier_RegionSpecifierType;
-using hbase::pb::ScanRequest;
-
-namespace hbase {
-
-RequestConverter::~RequestConverter() {}
-
-RequestConverter::RequestConverter() {}
-
-void RequestConverter::SetRegion(const std::string &region_name,
-                                 RegionSpecifier *region_specifier) {
-  region_specifier->set_type(
-      RegionSpecifier_RegionSpecifierType::RegionSpecifier_RegionSpecifierType_REGION_NAME);
-  region_specifier->set_value(region_name);
-}
-
-std::unique_ptr<Request> RequestConverter::ToGetRequest(const Get &get,
-                                                        const std::string &region_name)
{
-  auto pb_req = Request::get();
-
-  auto pb_msg = std::static_pointer_cast<GetRequest>(pb_req->req_msg());
-  RequestConverter::SetRegion(region_name, pb_msg->mutable_region());
-
-  auto pb_get = pb_msg->mutable_get();
-  pb_get->set_max_versions(get.MaxVersions());
-  pb_get->set_cache_blocks(get.CacheBlocks());
-  pb_get->set_consistency(get.Consistency());
-
-  if (!get.Timerange().IsAllTime()) {
-    hbase::pb::TimeRange *pb_time_range = pb_get->mutable_time_range();
-    pb_time_range->set_from(get.Timerange().MinTimeStamp());
-    pb_time_range->set_to(get.Timerange().MaxTimeStamp());
-  }
-  pb_get->set_row(get.Row());
-  if (get.HasFamilies()) {
-    for (const auto &family : get.Family()) {
-      auto column = pb_get->add_column();
-      column->set_family(family.first);
-      for (const auto &qualifier : family.second) {
-        column->add_qualifier(qualifier);
-      }
-    }
-  }
-
-  if (get.filter() != nullptr) {
-    pb_get->set_allocated_filter(Filter::ToProto(*(get.filter())).release());
-  }
-
-  return pb_req;
-}
-
-std::unique_ptr<Request> RequestConverter::ToScanRequest(const Scan &scan,
-                                                         const std::string &region_name)
{
-  auto pb_req = Request::scan();
-
-  auto pb_msg = std::static_pointer_cast<ScanRequest>(pb_req->req_msg());
-
-  RequestConverter::SetRegion(region_name, pb_msg->mutable_region());
-
-  auto pb_scan = pb_msg->mutable_scan();
-  pb_scan->set_max_versions(scan.MaxVersions());
-  pb_scan->set_cache_blocks(scan.CacheBlocks());
-  pb_scan->set_reversed(scan.IsReversed());
-  pb_scan->set_small(scan.IsSmall());
-  pb_scan->set_caching(scan.Caching());
-  pb_scan->set_start_row(scan.StartRow());
-  pb_scan->set_stop_row(scan.StopRow());
-  pb_scan->set_consistency(scan.Consistency());
-  pb_scan->set_max_result_size(scan.MaxResultSize());
-  pb_scan->set_allow_partial_results(scan.AllowPartialResults());
-  pb_scan->set_load_column_families_on_demand(scan.LoadColumnFamiliesOnDemand());
-
-  if (!scan.Timerange().IsAllTime()) {
-    hbase::pb::TimeRange *pb_time_range = pb_scan->mutable_time_range();
-    pb_time_range->set_from(scan.Timerange().MinTimeStamp());
-    pb_time_range->set_to(scan.Timerange().MaxTimeStamp());
-  }
-
-  if (scan.HasFamilies()) {
-    for (const auto &family : scan.Family()) {
-      auto column = pb_scan->add_column();
-      column->set_family(family.first);
-      for (const auto &qualifier : family.second) {
-        column->add_qualifier(qualifier);
-      }
-    }
-  }
-
-  if (scan.filter() != nullptr) {
-    pb_scan->set_allocated_filter(Filter::ToProto(*(scan.filter())).release());
-  }
-
-  // TODO We will change this later.
-  pb_msg->set_client_handles_partials(false);
-  pb_msg->set_client_handles_heartbeats(false);
-  pb_msg->set_track_scan_metrics(false);
-
-  return pb_req;
-}
-} /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/request_converter.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/request_converter.h b/hbase-native-client/core/request_converter.h
deleted file mode 100644
index 57f08cc..0000000
--- a/hbase-native-client/core/request_converter.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#pragma once
-
-#include <memory>
-#include <string>
-#include "connection/request.h"
-#include "core/get.h"
-#include "core/scan.h"
-#include "if/HBase.pb.h"
-
-using hbase::pb::RegionSpecifier;
-namespace hbase {
-
-/**
- * RequestConverter class
- * This class converts a Client side Get, Scan, Mutate operation to corresponding PB message.
- */
-class RequestConverter {
- public:
-  ~RequestConverter();
-
-  /**
-   * @brief Returns a Request object comprising of PB GetRequest created using
-   * passed 'get'
-   * @param get - Get object used for creating GetRequest
-   * @param region_name - table region
-   */
-  static std::unique_ptr<Request> ToGetRequest(const Get &get, const std::string
&region_name);
-
-  /**
-   * @brief Returns a Request object comprising of PB ScanRequest created using
-   * passed 'scan'
-   * @param scan - Scan object used for creating ScanRequest
-   * @param region_name - table region
-   */
-  static std::unique_ptr<Request> ToScanRequest(const Scan &scan, const std::string
&region_name);
-
- private:
-  // Constructor not required. We have all static methods to create PB requests.
-  RequestConverter();
-
-  /**
-   * @brief fills region_specifier with region values.
-   * @param region_name - table region
-   * @param region_specifier - RegionSpecifier to be filled and passed in PB
-   * Request.
-   */
-  static void SetRegion(const std::string &region_name, RegionSpecifier *region_specifier);
-};
-
-} /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/response-converter.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/response-converter.cc b/hbase-native-client/core/response-converter.cc
new file mode 100644
index 0000000..7bb5e5d
--- /dev/null
+++ b/hbase-native-client/core/response-converter.cc
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "core/response-converter.h"
+
+#include <string>
+#include <vector>
+
+#include "core/cell.h"
+
+using hbase::pb::GetResponse;
+using hbase::pb::ScanResponse;
+
+namespace hbase {
+
+ResponseConverter::ResponseConverter() {}
+
+ResponseConverter::~ResponseConverter() {}
+
+std::unique_ptr<Result> ResponseConverter::FromGetResponse(const Response& resp)
{
+  auto get_resp = std::static_pointer_cast<GetResponse>(resp.resp_msg());
+
+  return ToResult(get_resp->result(), resp.cell_scanner());
+}
+
+std::unique_ptr<Result> ResponseConverter::ToResult(
+    const hbase::pb::Result& result, const std::unique_ptr<CellScanner>& cell_scanner)
{
+  std::vector<std::shared_ptr<Cell>> vcells;
+  for (auto cell : result.cell()) {
+    std::shared_ptr<Cell> pcell =
+        std::make_shared<Cell>(cell.row(), cell.family(), cell.qualifier(), cell.timestamp(),
+                               cell.value(), static_cast<hbase::CellType>(cell.cell_type()));
+    vcells.push_back(pcell);
+  }
+
+  // iterate over the cells coming from rpc codec
+  if (cell_scanner != nullptr) {
+    while (cell_scanner->Advance()) {
+      vcells.push_back(cell_scanner->Current());
+    }
+    // TODO: check associated cell count?
+  }
+  return std::make_unique<Result>(vcells, result.exists(), result.stale(), result.partial());
+}
+
+std::vector<std::unique_ptr<Result>> ResponseConverter::FromScanResponse(const
Response& resp) {
+  auto scan_resp = std::static_pointer_cast<ScanResponse>(resp.resp_msg());
+  VLOG(3) << "FromScanResponse:" << scan_resp->ShortDebugString();
+  int num_results = resp.cell_scanner() != nullptr ? scan_resp->cells_per_result_size()
+                                                   : scan_resp->results_size();
+
+  std::vector<std::unique_ptr<Result>> results{static_cast<size_t>(num_results)};
+  for (int i = 0; i < num_results; i++) {
+    if (resp.cell_scanner() != nullptr) {
+      // Cells are out in cellblocks.  Group them up again as Results.  How many to read
at a
+      // time will be found in getCellsLength -- length here is how many Cells in the i'th
Result
+      int num_cells = scan_resp->cells_per_result(i);
+
+      std::vector<std::shared_ptr<Cell>> vcells;
+      while (resp.cell_scanner()->Advance()) {
+        vcells.push_back(resp.cell_scanner()->Current());
+      }
+      // TODO: check associated cell count?
+
+      if (vcells.size() != num_cells) {
+        std::string msg = "Results sent from server=" + std::to_string(num_results) +
+                          ". But only got " + std::to_string(i) +
+                          " results completely at client. Resetting the scanner to scan again.";
+        LOG(ERROR) << msg;
+        throw std::runtime_error(msg);
+      }
+      // TODO: handle partial results per Result by checking partial_flag_per_result
+      results[i] = std::make_unique<Result>(vcells, false, scan_resp->stale(), false);
+    } else {
+      results[i] = ToResult(scan_resp->results(i), resp.cell_scanner());
+    }
+  }
+
+  return results;
+}
+} /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/response-converter.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/response-converter.h b/hbase-native-client/core/response-converter.h
new file mode 100644
index 0000000..759b1ce
--- /dev/null
+++ b/hbase-native-client/core/response-converter.h
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#pragma once
+
+#include <memory>
+#include <vector>
+#include "connection/response.h"
+#include "core/result.h"
+#include "if/Client.pb.h"
+#include "serde/cell-scanner.h"
+
+namespace hbase {
+
+/**
+ * ResponseConverter class
+ * This class converts a PB Response to corresponding Result or other objects.
+ */
+class ResponseConverter {
+ public:
+  ~ResponseConverter();
+
+  static std::unique_ptr<Result> ToResult(const hbase::pb::Result& result,
+                                          const std::unique_ptr<CellScanner>& cell_scanner);
+
+  /**
+   * @brief Returns a Result object created by PB Message in passed Response object.
+   * @param resp - Response object having the PB message.
+   */
+  static std::unique_ptr<hbase::Result> FromGetResponse(const Response& resp);
+
+  static std::vector<std::unique_ptr<Result>> FromScanResponse(const Response&
resp);
+
+ private:
+  // Constructor not required. We have all static methods to extract response from PB messages.
+  ResponseConverter();
+};
+
+} /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/response_converter.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/response_converter.cc b/hbase-native-client/core/response_converter.cc
deleted file mode 100644
index 2497306..0000000
--- a/hbase-native-client/core/response_converter.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "core/response_converter.h"
-
-#include <string>
-#include <vector>
-
-#include "core/cell.h"
-
-using hbase::pb::GetResponse;
-using hbase::pb::ScanResponse;
-
-namespace hbase {
-
-ResponseConverter::ResponseConverter() {}
-
-ResponseConverter::~ResponseConverter() {}
-
-std::unique_ptr<Result> ResponseConverter::FromGetResponse(const Response& resp)
{
-  auto get_resp = std::static_pointer_cast<GetResponse>(resp.resp_msg());
-
-  return ToResult(get_resp->result(), resp.cell_scanner());
-}
-
-std::unique_ptr<Result> ResponseConverter::ToResult(
-    const hbase::pb::Result& result, const std::unique_ptr<CellScanner>& cell_scanner)
{
-  std::vector<std::shared_ptr<Cell>> vcells;
-  for (auto cell : result.cell()) {
-    std::shared_ptr<Cell> pcell =
-        std::make_shared<Cell>(cell.row(), cell.family(), cell.qualifier(), cell.timestamp(),
-                               cell.value(), static_cast<hbase::CellType>(cell.cell_type()));
-    vcells.push_back(pcell);
-  }
-
-  // iterate over the cells coming from rpc codec
-  if (cell_scanner != nullptr) {
-    while (cell_scanner->Advance()) {
-      vcells.push_back(cell_scanner->Current());
-    }
-    // TODO: check associated cell count?
-  }
-  return std::make_unique<Result>(vcells, result.exists(), result.stale(), result.partial());
-}
-
-std::vector<std::unique_ptr<Result>> ResponseConverter::FromScanResponse(const
Response& resp) {
-  auto scan_resp = std::static_pointer_cast<ScanResponse>(resp.resp_msg());
-  VLOG(3) << "FromScanResponse:" << scan_resp->ShortDebugString();
-  int num_results = resp.cell_scanner() != nullptr ? scan_resp->cells_per_result_size()
-                                                   : scan_resp->results_size();
-
-  std::vector<std::unique_ptr<Result>> results{static_cast<size_t>(num_results)};
-  for (int i = 0; i < num_results; i++) {
-    if (resp.cell_scanner() != nullptr) {
-      // Cells are out in cellblocks.  Group them up again as Results.  How many to read
at a
-      // time will be found in getCellsLength -- length here is how many Cells in the i'th
Result
-      int num_cells = scan_resp->cells_per_result(i);
-
-      std::vector<std::shared_ptr<Cell>> vcells;
-      while (resp.cell_scanner()->Advance()) {
-        vcells.push_back(resp.cell_scanner()->Current());
-      }
-      // TODO: check associated cell count?
-
-      if (vcells.size() != num_cells) {
-        std::string msg = "Results sent from server=" + std::to_string(num_results) +
-                          ". But only got " + std::to_string(i) +
-                          " results completely at client. Resetting the scanner to scan again.";
-        LOG(ERROR) << msg;
-        throw std::runtime_error(msg);
-      }
-      // TODO: handle partial results per Result by checking partial_flag_per_result
-      results[i] = std::make_unique<Result>(vcells, false, scan_resp->stale(), false);
-    } else {
-      results[i] = ToResult(scan_resp->results(i), resp.cell_scanner());
-    }
-  }
-
-  return results;
-}
-} /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/response_converter.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/response_converter.h b/hbase-native-client/core/response_converter.h
deleted file mode 100644
index 759b1ce..0000000
--- a/hbase-native-client/core/response_converter.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#pragma once
-
-#include <memory>
-#include <vector>
-#include "connection/response.h"
-#include "core/result.h"
-#include "if/Client.pb.h"
-#include "serde/cell-scanner.h"
-
-namespace hbase {
-
-/**
- * ResponseConverter class
- * This class converts a PB Response to corresponding Result or other objects.
- */
-class ResponseConverter {
- public:
-  ~ResponseConverter();
-
-  static std::unique_ptr<Result> ToResult(const hbase::pb::Result& result,
-                                          const std::unique_ptr<CellScanner>& cell_scanner);
-
-  /**
-   * @brief Returns a Result object created by PB Message in passed Response object.
-   * @param resp - Response object having the PB message.
-   */
-  static std::unique_ptr<hbase::Result> FromGetResponse(const Response& resp);
-
-  static std::vector<std::unique_ptr<Result>> FromScanResponse(const Response&
resp);
-
- private:
-  // Constructor not required. We have all static methods to extract response from PB messages.
-  ResponseConverter();
-};
-
-} /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/scan.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/scan.h b/hbase-native-client/core/scan.h
index 7e8c7bd..cedbe0a 100644
--- a/hbase-native-client/core/scan.h
+++ b/hbase-native-client/core/scan.h
@@ -25,7 +25,7 @@
 #include <string>
 #include <vector>
 #include "core/get.h"
-#include "core/time_range.h"
+#include "core/time-range.h"
 #include "if/Client.pb.h"
 
 namespace hbase {

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/table.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/table.cc b/hbase-native-client/core/table.cc
index ba4dc29..2ce8fcd 100644
--- a/hbase-native-client/core/table.cc
+++ b/hbase-native-client/core/table.cc
@@ -25,8 +25,8 @@
 #include <utility>
 #include <vector>
 
-#include "core/request_converter.h"
-#include "core/response_converter.h"
+#include "core/request-converter.h"
+#include "core/response-converter.h"
 #include "if/Client.pb.h"
 #include "security/user.h"
 #include "serde/server-name.h"

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/time-range-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/time-range-test.cc b/hbase-native-client/core/time-range-test.cc
new file mode 100644
index 0000000..136ab54
--- /dev/null
+++ b/hbase-native-client/core/time-range-test.cc
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "core/time-range.h"
+
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
+using namespace hbase;
+
+TEST(TimeRange, DefaultObject) {
+  TimeRange *timerange_def = nullptr;
+  ASSERT_NO_THROW(timerange_def = new TimeRange());
+
+  EXPECT_EQ(0, timerange_def->MinTimeStamp());
+  EXPECT_EQ(std::numeric_limits<int64_t>::max(), timerange_def->MaxTimeStamp());
+  EXPECT_NE(1000, timerange_def->MinTimeStamp());
+  EXPECT_NE(2000, timerange_def->MaxTimeStamp());
+  delete timerange_def;
+  timerange_def = nullptr;
+}
+
+TEST(TimeRange, Exception) {
+  // Negative Min TS
+  ASSERT_THROW(TimeRange(-1000, 2000), std::runtime_error);
+
+  // Negative Max TS
+  ASSERT_THROW(TimeRange(1000, -2000), std::runtime_error);
+
+  // Min TS > Max TS
+  ASSERT_THROW(TimeRange(10000, 2000), std::runtime_error);
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/time-range.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/time-range.cc b/hbase-native-client/core/time-range.cc
new file mode 100644
index 0000000..e6b789b
--- /dev/null
+++ b/hbase-native-client/core/time-range.cc
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "core/time-range.h"
+#include <limits>
+#include <stdexcept>
+#include <string>
+
+namespace hbase {
+
+TimeRange::TimeRange()
+    : min_timestamp_(0L), max_timestamp_(std::numeric_limits<int64_t>::max()), all_time_(true)
{}
+
+TimeRange::TimeRange(const TimeRange &tr) {
+  this->all_time_ = tr.all_time_;
+  this->max_timestamp_ = tr.max_timestamp_;
+  this->min_timestamp_ = tr.min_timestamp_;
+}
+
+TimeRange &TimeRange::operator=(const TimeRange &tr) {
+  this->all_time_ = tr.all_time_;
+  this->max_timestamp_ = tr.max_timestamp_;
+  this->min_timestamp_ = tr.min_timestamp_;
+  return *this;
+}
+
+TimeRange::~TimeRange() {}
+
+TimeRange::TimeRange(int64_t min_timestamp) {
+  this->min_timestamp_ = min_timestamp;
+  this->max_timestamp_ = std::numeric_limits<int64_t>::max();
+  this->all_time_ = false;
+}
+
+TimeRange::TimeRange(int64_t min_timestamp, int64_t max_timestamp) {
+  if (min_timestamp < 0 || max_timestamp < 0) {
+    throw std::runtime_error("Timestamp cannot be negative. min_timestamp: " +
+                             std::to_string(min_timestamp) + ", max_timestamp:" +
+                             std::to_string(max_timestamp));
+  }
+  if (max_timestamp < min_timestamp) {
+    throw std::runtime_error("max_timestamp [" + std::to_string(max_timestamp) +
+                             "] should be greater than min_timestamp [" +
+                             std::to_string(min_timestamp) + "]");
+  }
+
+  this->min_timestamp_ = min_timestamp;
+  this->max_timestamp_ = max_timestamp;
+  this->all_time_ = false;
+}
+
+int64_t TimeRange::MinTimeStamp() const { return this->min_timestamp_; }
+
+int64_t TimeRange::MaxTimeStamp() const { return this->max_timestamp_; }
+
+bool TimeRange::IsAllTime() const { return this->all_time_; }
+}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/time-range.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/time-range.h b/hbase-native-client/core/time-range.h
new file mode 100644
index 0000000..d645ecd
--- /dev/null
+++ b/hbase-native-client/core/time-range.h
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#pragma once
+
+#include <cstdint>
+
+namespace hbase {
+class TimeRange {
+ public:
+  /**
+   * @brief  Default constructor. Represents interval [0,
+   * std::numeric_limits<int64_t>::max())
+   * (allTime)
+   */
+  TimeRange();
+  TimeRange(const TimeRange &tr);
+  TimeRange &operator=(const TimeRange &tr);
+  /**
+   * @brief Represents interval [minStamp, std::numeric_limits<int64_t>::max())
+   * @param minStamp the minimum timestamp value, inclusive
+   */
+  explicit TimeRange(int64_t min_timestamp);
+  /**
+   * @brief Represents interval [minStamp, maxStamp)
+   * @param minStamp the minimum timestamp, inclusive
+   * @param maxStamp the maximum timestamp, exclusive
+   * @throws std::runtime_error if min_timestamp < 0 or max_timestamp < 0 or
+   * max_timestamp < min_timestamp
+   */
+  TimeRange(int64_t min_timestamp, int64_t max_timestamp);
+  int64_t MinTimeStamp() const;
+  int64_t MaxTimeStamp() const;
+  bool IsAllTime() const;
+  ~TimeRange();
+
+ private:
+  int64_t min_timestamp_;
+  int64_t max_timestamp_;
+  bool all_time_;
+};
+}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/time_range-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/time_range-test.cc b/hbase-native-client/core/time_range-test.cc
deleted file mode 100644
index 49cb359..0000000
--- a/hbase-native-client/core/time_range-test.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "core/time_range.h"
-
-#include <glog/logging.h>
-#include <gtest/gtest.h>
-
-using namespace hbase;
-
-TEST(TimeRange, DefaultObject) {
-  TimeRange *timerange_def = nullptr;
-  ASSERT_NO_THROW(timerange_def = new TimeRange());
-
-  EXPECT_EQ(0, timerange_def->MinTimeStamp());
-  EXPECT_EQ(std::numeric_limits<int64_t>::max(), timerange_def->MaxTimeStamp());
-  EXPECT_NE(1000, timerange_def->MinTimeStamp());
-  EXPECT_NE(2000, timerange_def->MaxTimeStamp());
-  delete timerange_def;
-  timerange_def = nullptr;
-}
-
-TEST(TimeRange, Exception) {
-  // Negative Min TS
-  ASSERT_THROW(TimeRange(-1000, 2000), std::runtime_error);
-
-  // Negative Max TS
-  ASSERT_THROW(TimeRange(1000, -2000), std::runtime_error);
-
-  // Min TS > Max TS
-  ASSERT_THROW(TimeRange(10000, 2000), std::runtime_error);
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/time_range.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/time_range.cc b/hbase-native-client/core/time_range.cc
deleted file mode 100644
index 04b70ec..0000000
--- a/hbase-native-client/core/time_range.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "core/time_range.h"
-#include <limits>
-#include <stdexcept>
-#include <string>
-
-namespace hbase {
-
-TimeRange::TimeRange()
-    : min_timestamp_(0L), max_timestamp_(std::numeric_limits<int64_t>::max()), all_time_(true)
{}
-
-TimeRange::TimeRange(const TimeRange &tr) {
-  this->all_time_ = tr.all_time_;
-  this->max_timestamp_ = tr.max_timestamp_;
-  this->min_timestamp_ = tr.min_timestamp_;
-}
-
-TimeRange &TimeRange::operator=(const TimeRange &tr) {
-  this->all_time_ = tr.all_time_;
-  this->max_timestamp_ = tr.max_timestamp_;
-  this->min_timestamp_ = tr.min_timestamp_;
-  return *this;
-}
-
-TimeRange::~TimeRange() {}
-
-TimeRange::TimeRange(int64_t min_timestamp) {
-  this->min_timestamp_ = min_timestamp;
-  this->max_timestamp_ = std::numeric_limits<int64_t>::max();
-  this->all_time_ = false;
-}
-
-TimeRange::TimeRange(int64_t min_timestamp, int64_t max_timestamp) {
-  if (min_timestamp < 0 || max_timestamp < 0) {
-    throw std::runtime_error("Timestamp cannot be negative. min_timestamp: " +
-                             std::to_string(min_timestamp) + ", max_timestamp:" +
-                             std::to_string(max_timestamp));
-  }
-  if (max_timestamp < min_timestamp) {
-    throw std::runtime_error("max_timestamp [" + std::to_string(max_timestamp) +
-                             "] should be greater than min_timestamp [" +
-                             std::to_string(min_timestamp) + "]");
-  }
-
-  this->min_timestamp_ = min_timestamp;
-  this->max_timestamp_ = max_timestamp;
-  this->all_time_ = false;
-}
-
-int64_t TimeRange::MinTimeStamp() const { return this->min_timestamp_; }
-
-int64_t TimeRange::MaxTimeStamp() const { return this->max_timestamp_; }
-
-bool TimeRange::IsAllTime() const { return this->all_time_; }
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/core/time_range.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/time_range.h b/hbase-native-client/core/time_range.h
deleted file mode 100644
index d645ecd..0000000
--- a/hbase-native-client/core/time_range.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#pragma once
-
-#include <cstdint>
-
-namespace hbase {
-class TimeRange {
- public:
-  /**
-   * @brief  Default constructor. Represents interval [0,
-   * std::numeric_limits<int64_t>::max())
-   * (allTime)
-   */
-  TimeRange();
-  TimeRange(const TimeRange &tr);
-  TimeRange &operator=(const TimeRange &tr);
-  /**
-   * @brief Represents interval [minStamp, std::numeric_limits<int64_t>::max())
-   * @param minStamp the minimum timestamp value, inclusive
-   */
-  explicit TimeRange(int64_t min_timestamp);
-  /**
-   * @brief Represents interval [minStamp, maxStamp)
-   * @param minStamp the minimum timestamp, inclusive
-   * @param maxStamp the maximum timestamp, exclusive
-   * @throws std::runtime_error if min_timestamp < 0 or max_timestamp < 0 or
-   * max_timestamp < min_timestamp
-   */
-  TimeRange(int64_t min_timestamp, int64_t max_timestamp);
-  int64_t MinTimeStamp() const;
-  int64_t MaxTimeStamp() const;
-  bool IsAllTime() const;
-  ~TimeRange();
-
- private:
-  int64_t min_timestamp_;
-  int64_t max_timestamp_;
-  bool all_time_;
-};
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/test-util/mini-cluster.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/test-util/mini-cluster.cc b/hbase-native-client/test-util/mini-cluster.cc
index b40b689..88a091c 100644
--- a/hbase-native-client/test-util/mini-cluster.cc
+++ b/hbase-native-client/test-util/mini-cluster.cc
@@ -19,17 +19,11 @@
 
 #include "test-util/mini-cluster.h"
 #include <glog/logging.h>
-#include <gtest/gtest.h>
+#include <fcntl.h>
 #include <boost/filesystem/operations.hpp>
 #include <boost/filesystem/fstream.hpp>
 #include <fstream>
-#include "core/client.h"
-#include "core/configuration.h"
-#include "core/get.h"
-#include "core/hbase_configuration_loader.h"
-#include "core/result.h"
-#include "core/table.h"
-#include "serde/table-name.h"
+
 
 using hbase::MiniCluster;
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/76919a74/hbase-native-client/test-util/mini-cluster.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/test-util/mini-cluster.h b/hbase-native-client/test-util/mini-cluster.h
index 9b8ca92..54842e1 100644
--- a/hbase-native-client/test-util/mini-cluster.h
+++ b/hbase-native-client/test-util/mini-cluster.h
@@ -18,17 +18,11 @@
  */
 #pragma once
 
-#include <gtest/gtest.h>
 #include <string>
-#include "core/client.h"
-#include "core/configuration.h"
-#include "core/get.h"
-#include "core/hbase_configuration_loader.h"
-#include "core/result.h"
-#include "core/table.h"
 #include "jni.h"
-#include "serde/table-name.h"
+
 namespace hbase {
+
 class MiniCluster {
  public:
   jobject StartCluster(int numRegionServers, std::string conf_path);


Mime
View raw message