hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [19/25] hbase git commit: HBASE-18725 [C++] Install header files as well as library
Date Fri, 15 Sep 2017 21:20:36 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/load-client.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/load-client.cc b/hbase-native-client/core/load-client.cc
deleted file mode 100644
index 8cceeef..0000000
--- a/hbase-native-client/core/load-client.cc
+++ /dev/null
@@ -1,390 +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 <folly/Logging.h>
-#include <folly/Random.h>
-#include <gflags/gflags.h>
-
-#include <atomic>
-#include <chrono>
-#include <iostream>
-#include <thread>
-
-#include "core/client.h"
-#include "core/get.h"
-#include "core/put.h"
-#include "core/table.h"
-#include "serde/table-name.h"
-#include "utils/time-util.h"
-
-using hbase::Client;
-using hbase::Configuration;
-using hbase::Get;
-using hbase::Put;
-using hbase::Table;
-using hbase::pb::TableName;
-using hbase::TimeUtil;
-using folly::Random;
-
-DEFINE_string(table, "load_test_table", "What table to do the reads and writes with");
-DEFINE_string(families, "f", "comma separated list of column family names");
-DEFINE_string(conf, "", "Conf directory to read the config from (optional)");
-DEFINE_string(zookeeper, "localhost:2181", "What zk quorum to talk to");
-DEFINE_string(znode, "/hbase", "parent znode");
-DEFINE_uint64(num_rows, 1'000'000, "How many rows to write and read");
-DEFINE_uint64(num_cols, 1000, "How many columns there are in a row");
-DEFINE_int32(threads, 10, "How many client threads");
-DEFINE_int32(batch_num_rows, 100, "number of rows in one multi-get / multi-put");
-DEFINE_uint64(report_num_rows, 5000, "How frequent we should report the progress");
-DEFINE_bool(gets, true, "perform gets");
-DEFINE_bool(scans, true, "perform scans");
-DEFINE_bool(puts, true, "perform put's");
-DEFINE_bool(appends, true, "perform append's");
-
-static constexpr const char *kNumColumn = "num";
-static constexpr const char *incrPrefix = "i";
-static constexpr const char *appendPrefix = "a";
-
-std::string PrefixZero(int total_width, int num) {
-  std::string str = std::to_string(num);
-  int prefix_len = total_width - str.length();
-  if (prefix_len > 0) {
-    return std::string(prefix_len, '0') + str;
-  }
-  return str;
-}
-
-bool Verify(std::shared_ptr<hbase::Result> result, std::string family, int m) {
-  auto col = std::to_string(m);
-  if (!result->Value(family, col)) {
-    LOG(ERROR) << "Column:" << col << " is not found for " << result->Row();
-    return false;
-  }
-  auto l = *(result->Value(family, col));
-  if (l != col) {
-    LOG(ERROR) << "value " << *(result->Value(family, "1")) << " is not " << col;
-    return false;
-  }
-  if (FLAGS_appends) {
-    if (!result->Value(family, incrPrefix + col)) {
-      LOG(ERROR) << "Column:" << (incrPrefix + col) << " is not found for " << result->Row();
-      return false;
-    }
-    auto int_val = hbase::BytesUtil::ToInt64(*(result->Value(family, incrPrefix + col)));
-    if (int_val != m) {
-      LOG(ERROR) << "value is not " << col << " for " << result->Row();
-      return false;
-    }
-    if (!result->Value(family, appendPrefix + col)) {
-      LOG(ERROR) << "Column:" << (appendPrefix + col) << " is not found for " << result->Row();
-      return false;
-    }
-    l = *(result->Value(family, appendPrefix + col));
-    if (l != col) {
-      LOG(ERROR) << "value " << *(result->Value(family, "1")) << " is not " << col;
-      return false;
-    }
-  }
-
-  return true;
-}
-
-bool Verify(std::shared_ptr<hbase::Result> result, const std::string &row,
-            const std::vector<std::string> &families) {
-  if (result == nullptr || result->IsEmpty()) {
-    LOG(ERROR) << "didn't get result";
-    return false;
-  }
-  if (result->Row().compare(row) != 0) {
-    LOG(ERROR) << "row " << result->Row() << " is not the expected: " << row;
-    return false;
-  }
-  // Test the values
-  for (auto family : families) {
-    if (!result->Value(family, kNumColumn)) {
-      LOG(ERROR) << "Column:" << kNumColumn << " is not found for " << result->Row();
-      return false;
-    }
-    auto cols = std::stoi(*(result->Value(family, kNumColumn)));
-    VLOG(3) << "Result for row:" << row << " contains " << std::to_string(cols) << " columns";
-    for (int m = 1; m <= cols; m++) {
-      if (!Verify(result, family, m)) return false;
-    }
-  }
-  return true;
-}
-
-bool DoScan(int iteration, uint64_t max_row, uint64_t rows, std::unique_ptr<Table> table,
-            const std::vector<std::string> &families) {
-  hbase::Scan scan{};
-  auto start = iteration * rows;
-  auto end = start + rows;
-  auto width = std::to_string(max_row).length();
-  scan.SetStartRow(PrefixZero(width, start));
-  if (end != max_row && end != max_row + 1) {
-    scan.SetStopRow(PrefixZero(width, end));
-  }
-
-  auto start_ns = TimeUtil::GetNowNanos();
-  auto scanner = table->Scan(scan);
-
-  auto cnt = 0;
-  auto r = scanner->Next();
-  while (r != nullptr) {
-    auto row = PrefixZero(width, start + cnt);
-    if (!Verify(r, row, families)) {
-      return false;
-    }
-    cnt++;
-    r = scanner->Next();
-    if (cnt != 0 && cnt % FLAGS_report_num_rows == 0) {
-      LOG(INFO) << "(Thread " << iteration << ") "
-                << "Scan iterated over " << cnt << " results in "
-                << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-    }
-  }
-  if (cnt != rows) {
-    LOG(ERROR) << "(Thread " << iteration << ") "
-               << "Expected number of results does not match. expected:" << rows
-               << ", actual:" << cnt;
-    return false;
-  }
-  LOG(INFO) << "(Thread " << iteration << ") "
-            << "scanned " << std::to_string(cnt) << " rows in " << TimeUtil::ElapsedMillis(start_ns)
-            << " ms.";
-  return true;
-}
-
-bool DoGet(int iteration, uint64_t max_row, uint64_t rows, std::unique_ptr<Table> table,
-           const std::vector<std::string> &families, uint64_t batch_num_rows) {
-  auto width = std::to_string(max_row).length();
-  auto start_ns = TimeUtil::GetNowNanos();
-  for (uint64_t k = iteration; k <= max_row;) {
-    uint64_t total_read = 0;
-    std::vector<hbase::Get> gets;
-    for (uint64_t i = 0; i < batch_num_rows && k <= max_row; ++i, k += FLAGS_threads) {
-      std::string row = PrefixZero(width, k);
-      hbase::Get get(row);
-      gets.push_back(get);
-    }
-    VLOG(3) << "getting for " << batch_num_rows << " rows";
-    auto results = table->Get(gets);
-    if (results.size() != gets.size()) {
-      LOG(ERROR) << "(Thread " << iteration << ") "
-                 << "Expected number of results does not match. expected:" << gets.size()
-                 << ", actual:" << results.size();
-      return false;
-    }
-    for (uint64_t i = 0; i < batch_num_rows && i < results.size(); ++i) {
-      if (!Verify(results[i], gets[i].row(), families)) {
-        return false;
-      }
-    }
-    total_read += gets.size();
-    if (total_read != 0 && total_read % FLAGS_report_num_rows == 0) {
-      LOG(INFO) << "(Thread " << iteration << ") "
-                << "Sent  " << total_read << " Multi-Get requests in "
-                << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-    }
-    k += batch_num_rows;
-  }
-  LOG(INFO) << "(Thread " << iteration << ") "
-            << "Sent " << rows << " gets"
-            << " in " << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-  return true;
-}
-
-void DoPut(int iteration, uint64_t max_row, uint64_t rows, int cols, std::unique_ptr<Table> table,
-           const std::vector<std::string> &families) {
-  auto start_ns = TimeUtil::GetNowNanos();
-  auto width = std::to_string(max_row).length();
-  for (uint64_t j = 0; j < rows; j++) {
-    std::string row = PrefixZero(width, iteration * rows + j);
-    auto put = Put{row};
-    for (auto family : families) {
-      auto n_cols = Random::rand32(1, cols);
-      put.AddColumn(family, kNumColumn, std::to_string(n_cols));
-      for (unsigned int k = 1; k <= n_cols; k++) {
-        put.AddColumn(family, std::to_string(k), std::to_string(k));
-      }
-    }
-    table->Put(put);
-    if ((j + 1) % FLAGS_report_num_rows == 0) {
-      LOG(INFO) << "(Thread " << iteration << ") "
-                << "Written " << std::to_string(j + 1) << " rows in "
-                << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-    }
-  }
-  LOG(INFO) << "(Thread " << iteration << ") "
-            << "written " << std::to_string(rows) << " rows"
-            << " in " << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-}
-
-bool DoAppendIncrement(int iteration, uint64_t max_row, uint64_t rows, int cols,
-                       std::unique_ptr<Table> table, const std::vector<std::string> &families) {
-  auto start_ns = TimeUtil::GetNowNanos();
-  auto width = std::to_string(max_row).length();
-  for (uint64_t j = 0; j < rows; j++) {
-    std::string row = PrefixZero(width, iteration * rows + j);
-    hbase::Get get(row);
-    auto result = table->Get(get);
-    for (auto family : families) {
-      auto n_cols = std::stoi(*(result->Value(family, kNumColumn)));
-      for (unsigned int k = 1; k <= n_cols; k++) {
-        table->Increment(
-            hbase::Increment{row}.AddColumn(family, incrPrefix + std::to_string(k), k));
-        if (!table->Append(hbase::Append{row}.Add(family, appendPrefix + std::to_string(k),
-                                                  std::to_string(k)))) {
-          LOG(ERROR) << "(Thread " << iteration << ") "
-                     << "append for " << row << " family: " << family << " failed";
-          return false;
-        }
-      }
-    }
-    if ((j + 1) % FLAGS_report_num_rows == 0)
-      LOG(INFO) << "(Thread " << iteration << ") "
-                << "Written " << std::to_string(j + 1) << " increments"
-                << " in " << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-  }
-  LOG(INFO) << "(Thread " << iteration << ") "
-            << "written " << std::to_string(rows) << " increments"
-            << " in " << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-  return true;
-}
-
-int main(int argc, char *argv[]) {
-  gflags::SetUsageMessage("Load client to manipulate multiple rows from HBase on the comamnd line");
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  google::InitGoogleLogging(argv[0]);
-  google::InstallFailureSignalHandler();
-  FLAGS_logtostderr = 1;
-  FLAGS_stderrthreshold = 1;
-
-  if (FLAGS_batch_num_rows < 1) {
-    LOG(ERROR) << "size of multi get should be positive";
-    return -1;
-  }
-  if (!FLAGS_gets && !FLAGS_scans && !FLAGS_puts) {
-    LOG(ERROR) << "Must perform at least Get or Put operations";
-    return -1;
-  }
-  std::shared_ptr<Configuration> conf = nullptr;
-  if (FLAGS_conf == "") {
-    // Configuration
-    conf = std::make_shared<Configuration>();
-    conf->Set("hbase.zookeeper.quorum", FLAGS_zookeeper);
-    conf->Set("zookeeper.znode.parent", FLAGS_znode);
-  } else {
-    setenv("HBASE_CONF", FLAGS_conf.c_str(), 1);
-    hbase::HBaseConfigurationLoader loader;
-    conf = std::make_shared<Configuration>(loader.LoadDefaultResources().value());
-  }
-  auto tn = std::make_shared<TableName>(folly::to<TableName>(FLAGS_table));
-  auto num_puts = FLAGS_num_rows;
-
-  auto client = std::make_unique<Client>(*conf);
-
-  // Do the Put requests
-
-  std::vector<std::string> families;
-  std::size_t pos = 0, found;
-  while ((found = FLAGS_families.find_first_of(',', pos)) != std::string::npos) {
-    families.push_back(FLAGS_families.substr(pos, found - pos));
-    pos = found + 1;
-  }
-  families.push_back(FLAGS_families.substr(pos));
-
-  int rows = FLAGS_num_rows / FLAGS_threads;
-  if (FLAGS_num_rows % FLAGS_threads != 0) rows++;
-  int cols = FLAGS_num_cols;
-  std::atomic<int8_t> succeeded{1};  // not using bool since we want atomic &=
-  if (FLAGS_puts) {
-    LOG(INFO) << "Sending put requests";
-    auto start_ns = TimeUtil::GetNowNanos();
-    std::vector<std::thread> writer_threads;
-    for (int i = 0; i < FLAGS_threads; i++) {
-      writer_threads.push_back(std::thread([&, i] {
-        auto table = client->Table(*tn);
-        DoPut(i, FLAGS_num_rows - 1, rows, cols, std::move(table), families);
-      }));
-    }
-    for (auto &t : writer_threads) {
-      t.join();
-    }
-    LOG(INFO) << "Successfully sent  " << num_puts << " Put requests in "
-              << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-  }
-  if (FLAGS_appends) {
-    LOG(INFO) << "Sending append/increment requests";
-    auto start_ns = TimeUtil::GetNowNanos();
-    std::vector<std::thread> writer_threads;
-    for (int i = 0; i < FLAGS_threads; i++) {
-      writer_threads.push_back(std::thread([&, i] {
-        auto table = client->Table(*tn);
-        succeeded &=
-            DoAppendIncrement(i, FLAGS_num_rows - 1, rows, cols, std::move(table), families);
-      }));
-    }
-    for (auto &t : writer_threads) {
-      t.join();
-    }
-    LOG(INFO) << "Successfully sent  " << num_puts << " append requests in "
-              << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-  }
-
-  if (FLAGS_scans) {
-    LOG(INFO) << "Sending scan requests";
-    auto start_ns = TimeUtil::GetNowNanos();
-    std::vector<std::thread> reader_threads;
-    for (int i = 0; i < FLAGS_threads; i++) {
-      reader_threads.push_back(std::thread([&, i] {
-        auto table1 = client->Table(*tn);
-        succeeded &= DoScan(i, FLAGS_num_rows - 1, rows, std::move(table1), families);
-      }));
-    }
-    for (auto &t : reader_threads) {
-      t.join();
-    }
-
-    LOG(INFO) << (succeeded.load() ? "Successfully " : "Failed. ") << " scannned " << num_puts
-              << " rows in " << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-  }
-
-  if (FLAGS_gets) {
-    LOG(INFO) << "Sending get requests";
-    auto start_ns = TimeUtil::GetNowNanos();
-    std::vector<std::thread> reader_threads;
-    for (int i = 0; i < FLAGS_threads; i++) {
-      reader_threads.push_back(std::thread([&, i] {
-        auto table1 = client->Table(*tn);
-        succeeded &=
-            DoGet(i, FLAGS_num_rows - 1, rows, std::move(table1), families, FLAGS_batch_num_rows);
-      }));
-    }
-    for (auto &t : reader_threads) {
-      t.join();
-    }
-
-    LOG(INFO) << (succeeded.load() ? "Successful. " : "Failed. ") << " sent multi-get requests for "
-              << num_puts << " rows in " << TimeUtil::ElapsedMillis(start_ns) << " ms.";
-  }
-  client->Close();
-
-  return succeeded.load() ? 0 : -1;
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/location-cache-retry-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/location-cache-retry-test.cc b/hbase-native-client/core/location-cache-retry-test.cc
deleted file mode 100644
index f154b69..0000000
--- a/hbase-native-client/core/location-cache-retry-test.cc
+++ /dev/null
@@ -1,112 +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 <gtest/gtest.h>
-
-#include "core/append.h"
-#include "core/cell.h"
-#include "core/client.h"
-#include "core/configuration.h"
-#include "core/delete.h"
-#include "core/get.h"
-#include "core/hbase-configuration-loader.h"
-#include "core/increment.h"
-#include "core/meta-utils.h"
-#include "core/put.h"
-#include "core/result.h"
-#include "core/table.h"
-#include "exceptions/exception.h"
-#include "serde/table-name.h"
-#include "test-util/test-util.h"
-#include "utils/bytes-util.h"
-
-using hbase::Cell;
-using hbase::Configuration;
-using hbase::Get;
-using hbase::MetaUtil;
-using hbase::RetriesExhaustedException;
-using hbase::Put;
-using hbase::Table;
-using hbase::TestUtil;
-
-using std::chrono_literals::operator"" s;
-
-class LocationCacheRetryTest : public ::testing::Test {
- public:
-  static std::unique_ptr<hbase::TestUtil> test_util;
-  static void SetUpTestCase() {
-    google::InstallFailureSignalHandler();
-    test_util = std::make_unique<hbase::TestUtil>();
-    test_util->StartMiniCluster(2);
-    test_util->conf()->SetInt("hbase.client.retries.number", 5);
-  }
-};
-
-std::unique_ptr<hbase::TestUtil> LocationCacheRetryTest::test_util = nullptr;
-
-TEST_F(LocationCacheRetryTest, GetFromMetaTable) {
-  auto tn = folly::to<hbase::pb::TableName>("hbase:meta");
-  auto row = "test1";
-
-  hbase::Client client(*LocationCacheRetryTest::test_util->conf());
-
-  // do a get against the other table, but not the actual table "t".
-  auto table = client.Table(tn);
-  hbase::Get get(row);
-  auto result = table->Get(get);
-
-  LocationCacheRetryTest::test_util->MoveRegion(MetaUtil::kMetaRegion, "");
-
-  std::this_thread::sleep_for(3s);  // sleep 3 sec
-
-  result = table->Get(get);
-}
-
-TEST_F(LocationCacheRetryTest, PutGet) {
-  LocationCacheRetryTest::test_util->CreateTable("t", "d");
-  LocationCacheRetryTest::test_util->CreateTable("t2", "d");
-
-  auto tn = folly::to<hbase::pb::TableName>("t");
-  auto tn2 = folly::to<hbase::pb::TableName>("t2");
-  auto row = "test1";
-
-  hbase::Client client(*LocationCacheRetryTest::test_util->conf());
-
-  // do a get against the other table, but not the actual table "t".
-  auto table = client.Table(tn);
-  auto table2 = client.Table(tn2);
-  hbase::Get get(row);
-  auto result = table2->Get(get);
-
-  // we should have already cached the location of meta right now. Now
-  // move the meta region to the other server so that we will get a NotServingRegionException
-  // when we do the actual location lookup request. If there is no invalidation
-  // of the meta's own location, then following put/get will result in retries exhausted.
-  LocationCacheRetryTest::test_util->MoveRegion(MetaUtil::kMetaRegion, "");
-
-  std::this_thread::sleep_for(3s);  // sleep 3 sec
-
-  table->Put(Put{row}.AddColumn("d", "1", "value1"));
-
-  result = table->Get(get);
-
-  ASSERT_TRUE(!result->IsEmpty()) << "Result shouldn't be empty.";
-  EXPECT_EQ("test1", result->Row());
-  EXPECT_EQ("value1", *(result->Value("d", "1")));
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/location-cache-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/location-cache-test.cc b/hbase-native-client/core/location-cache-test.cc
deleted file mode 100644
index fd96ff3..0000000
--- a/hbase-native-client/core/location-cache-test.cc
+++ /dev/null
@@ -1,164 +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/location-cache.h"
-
-#include <folly/Memory.h>
-#include <gtest/gtest.h>
-
-#include <chrono>
-
-#include "core/keyvalue-codec.h"
-#include "if/HBase.pb.h"
-#include "serde/table-name.h"
-#include "test-util/test-util.h"
-
-using hbase::Cell;
-using hbase::Configuration;
-using hbase::ConnectionPool;
-using hbase::MetaUtil;
-using hbase::LocationCache;
-using hbase::TestUtil;
-using hbase::KeyValueCodec;
-using std::chrono::milliseconds;
-
-class LocationCacheTest : public ::testing::Test {
- protected:
-  static void SetUpTestCase() {
-    google::InstallFailureSignalHandler();
-    test_util_ = std::make_unique<TestUtil>();
-    test_util_->StartMiniCluster(2);
-  }
-  static void TearDownTestCase() { test_util_.release(); }
-
-  virtual void SetUp() {}
-  virtual void TearDown() {}
-
- public:
-  static std::unique_ptr<TestUtil> test_util_;
-};
-
-std::unique_ptr<TestUtil> LocationCacheTest::test_util_ = nullptr;
-
-TEST_F(LocationCacheTest, TestGetMetaNodeContents) {
-  auto cpu = std::make_shared<wangle::CPUThreadPoolExecutor>(4);
-  auto io = std::make_shared<wangle::IOThreadPoolExecutor>(4);
-  auto codec = std::make_shared<KeyValueCodec>();
-  auto cp = std::make_shared<ConnectionPool>(io, cpu, codec, LocationCacheTest::test_util_->conf());
-  LocationCache cache{LocationCacheTest::test_util_->conf(), io, cpu, cp};
-  auto f = cache.LocateMeta();
-  auto result = f.get();
-  ASSERT_FALSE(f.hasException());
-  ASSERT_TRUE(result.has_port());
-  ASSERT_TRUE(result.has_host_name());
-  cpu->stop();
-  io->stop();
-}
-
-TEST_F(LocationCacheTest, TestGetRegionLocation) {
-  auto cpu = std::make_shared<wangle::CPUThreadPoolExecutor>(4);
-  auto io = std::make_shared<wangle::IOThreadPoolExecutor>(4);
-  auto codec = std::make_shared<KeyValueCodec>();
-  auto cp = std::make_shared<ConnectionPool>(io, cpu, codec, LocationCacheTest::test_util_->conf());
-  LocationCache cache{LocationCacheTest::test_util_->conf(), io, cpu, cp};
-
-  // If there is no table this should throw an exception
-  auto tn = folly::to<hbase::pb::TableName>("t");
-  auto row = "test";
-  ASSERT_ANY_THROW(cache.LocateFromMeta(tn, row).get(milliseconds(1000)));
-  LocationCacheTest::test_util_->CreateTable("t", "d");
-  auto loc = cache.LocateFromMeta(tn, row).get(milliseconds(1000));
-  ASSERT_TRUE(loc != nullptr);
-  cpu->stop();
-  io->stop();
-}
-
-TEST_F(LocationCacheTest, TestCaching) {
-  auto cpu = std::make_shared<wangle::CPUThreadPoolExecutor>(4);
-  auto io = std::make_shared<wangle::IOThreadPoolExecutor>(4);
-  auto codec = std::make_shared<KeyValueCodec>();
-  auto cp = std::make_shared<ConnectionPool>(io, cpu, codec, LocationCacheTest::test_util_->conf());
-  LocationCache cache{LocationCacheTest::test_util_->conf(), io, cpu, cp};
-
-  auto tn_1 = folly::to<hbase::pb::TableName>("t1");
-  auto tn_2 = folly::to<hbase::pb::TableName>("t2");
-  auto tn_3 = folly::to<hbase::pb::TableName>("t3");
-  auto row_a = "a";
-
-  // test location pulled from meta gets cached
-  ASSERT_ANY_THROW(cache.LocateRegion(tn_1, row_a).get(milliseconds(1000)));
-  ASSERT_ANY_THROW(cache.LocateFromMeta(tn_1, row_a).get(milliseconds(1000)));
-  LocationCacheTest::test_util_->CreateTable("t1", "d");
-
-  ASSERT_FALSE(cache.IsLocationCached(tn_1, row_a));
-  auto loc = cache.LocateRegion(tn_1, row_a).get(milliseconds(1000));
-  ASSERT_TRUE(cache.IsLocationCached(tn_1, row_a));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_1, row_a));
-
-  // test with two regions
-  std::vector<std::string> keys;
-  keys.push_back("b");
-  LocationCacheTest::test_util_->CreateTable("t2", "d", keys);
-
-  ASSERT_FALSE(cache.IsLocationCached(tn_2, "a"));
-  loc = cache.LocateRegion(tn_2, "a").get(milliseconds(1000));
-  ASSERT_TRUE(cache.IsLocationCached(tn_2, "a"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_2, "a"));
-
-  ASSERT_FALSE(cache.IsLocationCached(tn_2, "b"));
-  loc = cache.LocateRegion(tn_2, "b").get(milliseconds(1000));
-  ASSERT_TRUE(cache.IsLocationCached(tn_2, "b"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_2, "b"));
-  ASSERT_TRUE(cache.IsLocationCached(tn_2, "ba"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_2, "ba"));
-
-  // test with three regions
-  keys.clear();
-  keys.push_back("b");
-  keys.push_back("c");
-  LocationCacheTest::test_util_->CreateTable("t3", "d", keys);
-
-  ASSERT_FALSE(cache.IsLocationCached(tn_3, "c"));
-  ASSERT_FALSE(cache.IsLocationCached(tn_3, "ca"));
-  loc = cache.LocateRegion(tn_3, "ca").get(milliseconds(1000));
-  ASSERT_TRUE(cache.IsLocationCached(tn_3, "c"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_3, "c"));
-  ASSERT_TRUE(cache.IsLocationCached(tn_3, "ca"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_3, "ca"));
-
-  ASSERT_FALSE(cache.IsLocationCached(tn_3, "b"));
-  loc = cache.LocateRegion(tn_3, "b").get(milliseconds(1000));
-  ASSERT_TRUE(cache.IsLocationCached(tn_3, "b"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_3, "b"));
-  ASSERT_TRUE(cache.IsLocationCached(tn_3, "ba"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_3, "ba"));
-
-  // clear second region
-  cache.ClearCachedLocation(tn_3, "b");
-  ASSERT_FALSE(cache.IsLocationCached(tn_3, "b"));
-
-  ASSERT_FALSE(cache.IsLocationCached(tn_3, "a"));
-  loc = cache.LocateRegion(tn_3, "a").get(milliseconds(1000));
-  ASSERT_TRUE(cache.IsLocationCached(tn_3, "a"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_3, "a"));
-  ASSERT_TRUE(cache.IsLocationCached(tn_3, "abc"));
-  ASSERT_EQ(loc, cache.GetCachedLocation(tn_3, "abc"));
-
-  cpu->stop();
-  io->stop();
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/location-cache.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/location-cache.cc b/hbase-native-client/core/location-cache.cc
deleted file mode 100644
index b728d95..0000000
--- a/hbase-native-client/core/location-cache.cc
+++ /dev/null
@@ -1,334 +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/location-cache.h"
-
-#include <folly/Conv.h>
-#include <folly/Logging.h>
-#include <folly/io/IOBuf.h>
-#include <wangle/concurrent/CPUThreadPoolExecutor.h>
-#include <wangle/concurrent/IOThreadPoolExecutor.h>
-
-#include <map>
-#include <shared_mutex>
-#include <utility>
-
-#include "connection/response.h"
-#include "connection/rpc-connection.h"
-#include "core/meta-utils.h"
-#include "exceptions/exception.h"
-#include "if/Client.pb.h"
-#include "if/ZooKeeper.pb.h"
-#include "serde/region-info.h"
-#include "serde/server-name.h"
-#include "serde/zk.h"
-
-using hbase::pb::MetaRegionServer;
-using hbase::pb::ServerName;
-using hbase::pb::TableName;
-
-namespace hbase {
-
-LocationCache::LocationCache(std::shared_ptr<hbase::Configuration> conf,
-                             std::shared_ptr<wangle::IOThreadPoolExecutor> io_executor,
-                             std::shared_ptr<wangle::CPUThreadPoolExecutor> cpu_executor,
-                             std::shared_ptr<ConnectionPool> cp)
-    : conf_(conf),
-      io_executor_(io_executor),
-      cpu_executor_(cpu_executor),
-      cp_(cp),
-      meta_promise_(nullptr),
-      meta_lock_(),
-      meta_util_(),
-      zk_(nullptr),
-      cached_locations_(),
-      locations_lock_() {
-  zk_quorum_ = ZKUtil::ParseZooKeeperQuorum(*conf_);
-  EnsureZooKeeperConnection();
-}
-
-LocationCache::~LocationCache() { CloseZooKeeperConnection(); }
-
-void LocationCache::CloseZooKeeperConnection() {
-  if (zk_ != nullptr) {
-    zookeeper_close(zk_);
-    zk_ = nullptr;
-    LOG(INFO) << "Closed connection to ZooKeeper.";
-  }
-}
-
-void LocationCache::EnsureZooKeeperConnection() {
-  if (zk_ == nullptr) {
-    LOG(INFO) << "Connecting to ZooKeeper. Quorum:" + zk_quorum_;
-    auto session_timeout = ZKUtil::SessionTimeout(*conf_);
-    zk_ = zookeeper_init(zk_quorum_.c_str(), nullptr, session_timeout, nullptr, nullptr, 0);
-  }
-}
-
-folly::Future<ServerName> LocationCache::LocateMeta() {
-  std::lock_guard<std::recursive_mutex> g(meta_lock_);
-  if (meta_promise_ == nullptr) {
-    this->RefreshMetaLocation();
-  }
-  return meta_promise_->getFuture().onError([&](const folly::exception_wrapper &ew) {
-    auto promise = InvalidateMeta();
-    if (promise) {
-      promise->setException(ew);
-    }
-    throw ew;
-    return ServerName{};
-  });
-}
-
-std::shared_ptr<folly::SharedPromise<hbase::pb::ServerName>> LocationCache::InvalidateMeta() {
-  VLOG(2) << "Invalidating meta location";
-  std::lock_guard<std::recursive_mutex> g(meta_lock_);
-  if (meta_promise_ != nullptr) {
-    // return the unique_ptr back to the caller.
-    std::shared_ptr<folly::SharedPromise<hbase::pb::ServerName>> ret = nullptr;
-    std::swap(ret, meta_promise_);
-    return ret;
-  } else {
-    return nullptr;
-  }
-}
-
-void LocationCache::RefreshMetaLocation() {
-  meta_promise_ = std::make_shared<folly::SharedPromise<ServerName>>();
-  auto p = meta_promise_;
-  cpu_executor_->add([this, p] {
-    std::lock_guard<std::recursive_mutex> g(meta_lock_);
-    p->setWith([&] { return this->ReadMetaLocation(); });
-  });
-}
-
-// Note: this is a blocking call to zookeeper
-ServerName LocationCache::ReadMetaLocation() {
-  auto buf = folly::IOBuf::create(4096);
-  ZkDeserializer derser;
-  EnsureZooKeeperConnection();
-
-  // This needs to be int rather than size_t as that's what ZK expects.
-  int len = buf->capacity();
-  std::string zk_node = ZKUtil::MetaZNode(*conf_);
-  int zk_result = zoo_get(this->zk_, zk_node.c_str(), 0,
-                          reinterpret_cast<char *>(buf->writableData()), &len, nullptr);
-  if (zk_result != ZOK || len < 9) {
-    LOG(ERROR) << "Error getting meta location.";
-    // We just close the zk connection, and let the upper levels retry.
-    CloseZooKeeperConnection();
-    throw std::runtime_error("Error getting meta location. Quorum: " + zk_quorum_);
-  }
-  buf->append(len);
-
-  MetaRegionServer mrs;
-  if (derser.Parse(buf.get(), &mrs) == false) {
-    LOG(ERROR) << "Unable to decode";
-    throw std::runtime_error("Error getting meta location (Unable to decode). Quorum: " +
-                             zk_quorum_);
-  }
-  return mrs.server();
-}
-
-folly::Future<std::shared_ptr<RegionLocation>> LocationCache::LocateFromMeta(
-    const TableName &tn, const std::string &row) {
-  return this->LocateMeta()
-      .via(cpu_executor_.get())
-      .then([this](ServerName sn) {
-        // TODO: use RpcClient?
-        auto remote_id = std::make_shared<ConnectionId>(sn.host_name(), sn.port());
-        return this->cp_->GetConnection(remote_id);
-      })
-      .then([tn, row, this](std::shared_ptr<RpcConnection> rpc_connection) {
-        return rpc_connection->SendRequest(std::move(meta_util_.MetaRequest(tn, row)));
-      })
-      .onError([&](const folly::exception_wrapper &ew) {
-        auto promise = InvalidateMeta();
-        throw ew;
-        return static_cast<std::unique_ptr<Response>>(nullptr);
-      })
-      .then([tn, this](std::unique_ptr<Response> resp) {
-        // take the protobuf response and make it into
-        // a region location.
-        return meta_util_.CreateLocation(std::move(*resp), tn);
-      })
-      .then([tn, this](std::shared_ptr<RegionLocation> rl) {
-        // Make sure that the correct location was found.
-        if (rl->region_info().table_name().namespace_() != tn.namespace_() ||
-            rl->region_info().table_name().qualifier() != tn.qualifier()) {
-          throw TableNotFoundException(folly::to<std::string>(tn));
-        }
-        return rl;
-      })
-      .then([this](std::shared_ptr<RegionLocation> rl) {
-        auto remote_id =
-            std::make_shared<ConnectionId>(rl->server_name().host_name(), rl->server_name().port());
-        return rl;
-      })
-      .then([tn, this](std::shared_ptr<RegionLocation> rl) {
-        // now add fetched location to the cache.
-        this->CacheLocation(tn, rl);
-        return rl;
-      });
-}
-
-constexpr const char *MetaUtil::kMetaRegionName;
-
-folly::Future<std::shared_ptr<RegionLocation>> LocationCache::LocateRegion(
-    const TableName &tn, const std::string &row, const RegionLocateType locate_type,
-    const int64_t locate_ns) {
-  // We maybe asked to locate meta itself
-  if (MetaUtil::IsMeta(tn)) {
-    return LocateMeta().then([this](const ServerName &server_name) {
-      auto rl = std::make_shared<RegionLocation>(MetaUtil::kMetaRegionName,
-                                                 meta_util_.meta_region_info(), server_name);
-      return rl;
-    });
-  }
-
-  // TODO: implement region locate type and timeout
-  auto cached_loc = this->GetCachedLocation(tn, row);
-  if (cached_loc != nullptr) {
-    return cached_loc;
-  } else {
-    return this->LocateFromMeta(tn, row);
-  }
-}
-
-// must hold shared lock on locations_lock_
-std::shared_ptr<RegionLocation> LocationCache::GetCachedLocation(const hbase::pb::TableName &tn,
-                                                                 const std::string &row) {
-  auto t_locs = this->GetTableLocations(tn);
-  std::shared_lock<folly::SharedMutexWritePriority> lock(locations_lock_);
-
-  // looking for the "floor" key as a start key
-  auto possible_region = t_locs->upper_bound(row);
-
-  if (t_locs->empty()) {
-    VLOG(5) << "Could not find region in cache, table map is empty";
-    return nullptr;
-  }
-
-  if (possible_region == t_locs->begin()) {
-    VLOG(5) << "Could not find region in cache, all keys are greater, row:" << row
-            << " ,possible_region:" << possible_region->second->DebugString();
-    return nullptr;
-  }
-  --possible_region;
-
-  VLOG(5) << "Found possible region in cache for row:" << row
-          << " ,possible_region:" << possible_region->second->DebugString();
-
-  // found possible start key, now need to check end key
-  if (possible_region->second->region_info().end_key() == "" ||
-      possible_region->second->region_info().end_key() > row) {
-    VLOG(2) << "Found region in cache for row:" << row
-            << " ,region:" << possible_region->second->DebugString();
-    return possible_region->second;
-  } else {
-    return nullptr;
-  }
-}
-
-// must hold unique lock on locations_lock_
-void LocationCache::CacheLocation(const hbase::pb::TableName &tn,
-                                  const std::shared_ptr<RegionLocation> loc) {
-  auto t_locs = this->GetTableLocations(tn);
-  std::unique_lock<folly::SharedMutexWritePriority> lock(locations_lock_);
-
-  (*t_locs)[loc->region_info().start_key()] = loc;
-  VLOG(1) << "Cached location for region:" << loc->DebugString();
-}
-
-// must hold shared lock on locations_lock_
-bool LocationCache::IsLocationCached(const hbase::pb::TableName &tn, const std::string &row) {
-  return (this->GetCachedLocation(tn, row) != nullptr);
-}
-
-// shared lock needed for cases when this table has been requested before;
-// in the rare case it hasn't, unique lock will be grabbed to add it to cache
-std::shared_ptr<hbase::PerTableLocationMap> LocationCache::GetTableLocations(
-    const hbase::pb::TableName &tn) {
-  auto found_locs = this->GetCachedTableLocations(tn);
-  if (found_locs == nullptr) {
-    found_locs = this->GetNewTableLocations(tn);
-  }
-  return found_locs;
-}
-
-std::shared_ptr<hbase::PerTableLocationMap> LocationCache::GetCachedTableLocations(
-    const hbase::pb::TableName &tn) {
-  folly::SharedMutexWritePriority::ReadHolder r_holder{locations_lock_};
-
-  auto table_locs = cached_locations_.find(tn);
-  if (table_locs != cached_locations_.end()) {
-    return table_locs->second;
-  } else {
-    return nullptr;
-  }
-}
-
-std::shared_ptr<hbase::PerTableLocationMap> LocationCache::GetNewTableLocations(
-    const hbase::pb::TableName &tn) {
-  // double-check locking under upgradable lock
-  folly::SharedMutexWritePriority::UpgradeHolder u_holder{locations_lock_};
-
-  auto table_locs = cached_locations_.find(tn);
-  if (table_locs != cached_locations_.end()) {
-    return table_locs->second;
-  }
-  folly::SharedMutexWritePriority::WriteHolder w_holder{std::move(u_holder)};
-
-  auto t_locs_p = std::make_shared<std::map<std::string, std::shared_ptr<RegionLocation>>>();
-  cached_locations_.insert(std::make_pair(tn, t_locs_p));
-  return t_locs_p;
-}
-
-// must hold unique lock on locations_lock_
-void LocationCache::ClearCache() {
-  std::unique_lock<folly::SharedMutexWritePriority> lock(locations_lock_);
-  cached_locations_.clear();
-}
-
-// must hold unique lock on locations_lock_
-void LocationCache::ClearCachedLocations(const hbase::pb::TableName &tn) {
-  VLOG(1) << "ClearCachedLocations, table:" << folly::to<std::string>(tn);
-  std::unique_lock<folly::SharedMutexWritePriority> lock(locations_lock_);
-  cached_locations_.erase(tn);
-  if (MetaUtil::IsMeta(tn)) {
-    InvalidateMeta();
-  }
-}
-
-// must hold unique lock on locations_lock_
-void LocationCache::ClearCachedLocation(const hbase::pb::TableName &tn, const std::string &row) {
-  VLOG(1) << "ClearCachedLocation, table:" << folly::to<std::string>(tn) << ", row:" << row;
-  auto table_locs = this->GetTableLocations(tn);
-  std::unique_lock<folly::SharedMutexWritePriority> lock(locations_lock_);
-  table_locs->erase(row);
-  if (MetaUtil::IsMeta(tn)) {
-    InvalidateMeta();
-  }
-}
-
-void LocationCache::UpdateCachedLocation(const RegionLocation &loc,
-                                         const folly::exception_wrapper &error) {
-  // TODO: just clears the location for now. We can inspect RegionMovedExceptions, etc later.
-  ClearCachedLocation(loc.region_info().table_name(), loc.region_info().start_key());
-}
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/location-cache.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/location-cache.h b/hbase-native-client/core/location-cache.h
deleted file mode 100644
index 6eb61ef..0000000
--- a/hbase-native-client/core/location-cache.h
+++ /dev/null
@@ -1,219 +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 <folly/ExceptionWrapper.h>
-#include <folly/Executor.h>
-#include <folly/SharedMutex.h>
-#include <folly/futures/Future.h>
-#include <folly/futures/SharedPromise.h>
-#include <wangle/concurrent/CPUThreadPoolExecutor.h>
-#include <wangle/concurrent/IOThreadPoolExecutor.h>
-#include <zookeeper/zookeeper.h>
-
-#include <map>
-#include <memory>
-#include <mutex>
-#include <string>
-#include <unordered_map>
-
-#include "connection/connection-pool.h"
-#include "core/async-region-locator.h"
-#include "core/configuration.h"
-#include "core/meta-utils.h"
-#include "core/region-location.h"
-#include "core/zk-util.h"
-#include "serde/table-name.h"
-
-namespace hbase {
-// Forward
-class Request;
-class Response;
-namespace pb {
-class ServerName;
-class TableName;
-}
-
-/** Equals function for TableName (uses namespace and table name) */
-struct TableNameEquals {
-  /** equals */
-  bool operator()(const hbase::pb::TableName &lht, const hbase::pb::TableName &rht) const {
-    return lht.namespace_() == rht.namespace_() && lht.qualifier() == rht.qualifier();
-  }
-};
-
-/** Hash for TableName. */
-struct TableNameHash {
-  /** hash */
-  std::size_t operator()(hbase::pb::TableName const &t) const {
-    std::size_t h = 0;
-    boost::hash_combine(h, t.namespace_());
-    boost::hash_combine(h, t.qualifier());
-    return h;
-  }
-};
-
-// typedefs for location cache
-typedef std::map<std::string, std::shared_ptr<RegionLocation>> PerTableLocationMap;
-typedef std::unordered_map<hbase::pb::TableName, std::shared_ptr<PerTableLocationMap>,
-                           TableNameHash, TableNameEquals>
-    RegionLocationMap;
-
-/**
- * Class that can look up and cache locations.
- */
-class LocationCache : public AsyncRegionLocator {
- public:
-  /**
-   * Constructor.
-   * @param conf Configuration instance to fetch Zookeeper Quorum and Zookeeper Znode.
-   * @param cpu_executor executor used to run non network IO based
-   * continuations.
-   * @param io_executor executor used to talk to the network
-   */
-  LocationCache(std::shared_ptr<hbase::Configuration> conf,
-                std::shared_ptr<wangle::IOThreadPoolExecutor> io_executor,
-                std::shared_ptr<wangle::CPUThreadPoolExecutor> cpu_executor,
-                std::shared_ptr<ConnectionPool> cp);
-  /**
-   * Destructor.
-   * This will clean up the zookeeper connections.
-   */
-  ~LocationCache();
-
-  /**
-   * Where is meta hosted.
-   *
-   * TODO: This should be a RegionLocation.
-   */
-  folly::Future<hbase::pb::ServerName> LocateMeta();
-
-  /**
-   * Go read meta and find out where a region is located. Most users should
-   * never call this method directly and should use LocateRegion() instead.
-   *
-   * @param tn Table name of the table to look up. This object must live until
-   * after the future is returned
-   *
-   * @param row of the table to look up. This object must live until after the
-   * future is returned
-   */
-  folly::Future<std::shared_ptr<RegionLocation>> LocateFromMeta(const hbase::pb::TableName &tn,
-                                                                const std::string &row);
-
-  /**
-   * The only method clients should use for meta lookups. If corresponding
-   * location is cached, it's returned from the cache, otherwise lookup
-   * in meta table is done, location is cached and then returned.
-   * It's expected that tiny fraction of invocations incurs meta scan.
-   * This method is to look up non-meta regions; use LocateMeta() to get the
-   * location of hbase:meta region.
-   *
-   * @param tn Table name of the table to look up. This object must live until
-   * after the future is returned
-   *
-   * @param row of the table to look up. This object must live until after the
-   * future is returned
-   */
-  folly::Future<std::shared_ptr<RegionLocation>> LocateRegion(
-      const hbase::pb::TableName &tn, const std::string &row,
-      const RegionLocateType locate_type = RegionLocateType::kCurrent,
-      const int64_t locate_ns = 0) override;
-
-  /**
-   * Remove the cached location of meta.
-   */
-  std::shared_ptr<folly::SharedPromise<hbase::pb::ServerName>> InvalidateMeta();
-
-  /**
-   * Return cached region location corresponding to this row,
-   * nullptr if this location isn't cached.
-   */
-  std::shared_ptr<RegionLocation> GetCachedLocation(const hbase::pb::TableName &tn,
-                                                    const std::string &row);
-
-  /**
-   * Add non-meta region location in the cache (location of meta itself
-   * is cached separately).
-   */
-  void CacheLocation(const hbase::pb::TableName &tn, const std::shared_ptr<RegionLocation> loc);
-
-  /**
-   * Check if location corresponding to this row key is cached.
-   */
-  bool IsLocationCached(const hbase::pb::TableName &tn, const std::string &row);
-
-  /**
-   * Return cached location for all region of this table.
-   */
-  std::shared_ptr<PerTableLocationMap> GetTableLocations(const hbase::pb::TableName &tn);
-
-  /**
-   * Completely clear location cache.
-   */
-  void ClearCache();
-
-  /**
-   * Clear all cached locations for one table.
-   */
-  void ClearCachedLocations(const hbase::pb::TableName &tn);
-
-  /**
-   * Clear cached region location.
-   */
-  void ClearCachedLocation(const hbase::pb::TableName &tn, const std::string &row);
-
-  /**
-   * Update cached region location, possibly using the information from exception.
-   */
-  void UpdateCachedLocation(const RegionLocation &loc,
-                            const folly::exception_wrapper &error) override;
-
-  const std::string &zk_quorum() { return zk_quorum_; }
-
- private:
-  void CloseZooKeeperConnection();
-  void EnsureZooKeeperConnection();
-
- private:
-  void RefreshMetaLocation();
-  hbase::pb::ServerName ReadMetaLocation();
-  std::shared_ptr<RegionLocation> CreateLocation(const Response &resp);
-  std::shared_ptr<hbase::PerTableLocationMap> GetCachedTableLocations(
-      const hbase::pb::TableName &tn);
-  std::shared_ptr<hbase::PerTableLocationMap> GetNewTableLocations(const hbase::pb::TableName &tn);
-
-  /* data */
-  std::shared_ptr<hbase::Configuration> conf_;
-  std::string zk_quorum_;
-  std::shared_ptr<wangle::IOThreadPoolExecutor> io_executor_;
-  std::shared_ptr<wangle::CPUThreadPoolExecutor> cpu_executor_;
-  std::shared_ptr<folly::SharedPromise<hbase::pb::ServerName>> meta_promise_;
-  std::recursive_mutex meta_lock_;
-  MetaUtil meta_util_;
-  std::shared_ptr<ConnectionPool> cp_;
-
-  // cached region locations
-  RegionLocationMap cached_locations_;
-  folly::SharedMutexWritePriority locations_lock_;
-
-  // TODO: migrate this to a smart pointer with a deleter.
-  zhandle_t *zk_;
-};
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/meta-utils.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/meta-utils.cc b/hbase-native-client/core/meta-utils.cc
deleted file mode 100644
index 31349a5..0000000
--- a/hbase-native-client/core/meta-utils.cc
+++ /dev/null
@@ -1,125 +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/meta-utils.h"
-
-#include <folly/Conv.h>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "connection/request.h"
-#include "connection/response.h"
-#include "core/response-converter.h"
-#include "exceptions/exception.h"
-#include "if/Client.pb.h"
-#include "serde/region-info.h"
-#include "serde/server-name.h"
-#include "serde/table-name.h"
-
-using hbase::pb::TableName;
-using hbase::pb::RegionInfo;
-using hbase::pb::RegionSpecifier_RegionSpecifierType;
-using hbase::pb::ScanRequest;
-using hbase::pb::ServerName;
-
-namespace hbase {
-
-MetaUtil::MetaUtil() {
-  meta_region_info_.set_start_key("");
-  meta_region_info_.set_end_key("");
-  meta_region_info_.set_offline(false);
-  meta_region_info_.set_split(false);
-  meta_region_info_.set_replica_id(0);
-  meta_region_info_.set_split(false);
-  meta_region_info_.set_region_id(1);
-  meta_region_info_.mutable_table_name()->set_namespace_(MetaUtil::kSystemNamespace);
-  meta_region_info_.mutable_table_name()->set_qualifier(MetaUtil::kMetaTableQualifier);
-}
-
-std::string MetaUtil::RegionLookupRowkey(const TableName &tn, const std::string &row) const {
-  return folly::to<std::string>(tn, ",", row, ",", "999999999999999999");
-}
-
-std::unique_ptr<Request> MetaUtil::MetaRequest(const TableName tn, const std::string &row) const {
-  auto request = Request::scan();
-  auto msg = std::static_pointer_cast<ScanRequest>(request->req_msg());
-
-  msg->set_number_of_rows(1);
-  msg->set_close_scanner(true);
-
-  // Set the region this scan goes to
-  auto region = msg->mutable_region();
-  region->set_value(MetaUtil::kMetaRegion);
-  region->set_type(
-      RegionSpecifier_RegionSpecifierType::RegionSpecifier_RegionSpecifierType_ENCODED_REGION_NAME);
-
-  auto scan = msg->mutable_scan();
-  // We don't care about before, just now.
-  scan->set_max_versions(1);
-  // Meta should be cached at all times.
-  scan->set_cache_blocks(true);
-  // We only want one row right now.
-  //
-  // TODO(eclark): Figure out if we should get more.
-  scan->set_caching(1);
-  // Close the scan after we have data.
-  scan->set_small(true);
-  // We know where to start but not where to end.
-  scan->set_reversed(true);
-  // Give me everything or nothing.
-  scan->set_allow_partial_results(false);
-
-  // Set the columns that we need
-  auto info_col = scan->add_column();
-  info_col->set_family(MetaUtil::kCatalogFamily);
-  info_col->add_qualifier(MetaUtil::kServerColumn);
-  info_col->add_qualifier(MetaUtil::kRegionInfoColumn);
-
-  scan->set_start_row(RegionLookupRowkey(tn, row));
-  return request;
-}
-
-std::shared_ptr<RegionLocation> MetaUtil::CreateLocation(const Response &resp,
-                                                         const TableName &tn) {
-  std::vector<std::shared_ptr<Result>> results = ResponseConverter::FromScanResponse(resp);
-  if (results.size() == 0) {
-    throw TableNotFoundException(folly::to<std::string>(tn));
-  }
-  if (results.size() != 1) {
-    throw std::runtime_error("Was expecting exactly 1 result in meta scan response, got:" +
-                             std::to_string(results.size()));
-  }
-  auto result = *results[0];
-
-  auto region_info_str = result.Value(MetaUtil::kCatalogFamily, MetaUtil::kRegionInfoColumn);
-  auto server_str = result.Value(MetaUtil::kCatalogFamily, MetaUtil::kServerColumn);
-  CHECK(region_info_str);
-  CHECK(server_str);
-
-  auto row = result.Row();
-  auto region_info = folly::to<RegionInfo>(*region_info_str);
-  auto server_name = folly::to<ServerName>(*server_str);
-  return std::make_shared<RegionLocation>(row, std::move(region_info), server_name);
-}
-
-bool MetaUtil::IsMeta(const hbase::pb::TableName &tn) {
-  return folly::to<std::string>(tn) == MetaUtil::kMetaTableName;
-}
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/meta-utils.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/meta-utils.h b/hbase-native-client/core/meta-utils.h
deleted file mode 100644
index d178179..0000000
--- a/hbase-native-client/core/meta-utils.h
+++ /dev/null
@@ -1,76 +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 "connection/response.h"
-#include "core/region-location.h"
-#include "if/HBase.pb.h"
-#include "serde/table-name.h"
-
-namespace hbase {
-
-/**
- * @brief Utility for meta operations.
- */
-class MetaUtil {
- public:
-  static constexpr const char *kSystemNamespace = "hbase";
-  static constexpr const char *kMetaTableQualifier = "meta";
-  static constexpr const char *kMetaTableName = "hbase:meta";
-  static constexpr const char *kMetaRegion = "1588230740";
-  static constexpr const char *kMetaRegionName = "hbase:meta,,1";
-  static constexpr const char *kCatalogFamily = "info";
-  static constexpr const char *kRegionInfoColumn = "regioninfo";
-  static constexpr const char *kServerColumn = "server";
-
-  MetaUtil();
-
-  /**
-   * Given a table and a row give the row key from which to start a scan to find
-   * region locations.
-   */
-  std::string RegionLookupRowkey(const hbase::pb::TableName &tn, const std::string &row) const;
-
-  /**
-   * Given a row we're trying to access create a request to look up the
-   * location.
-   */
-  std::unique_ptr<Request> MetaRequest(const hbase::pb::TableName tn, const std::string &row) const;
-
-  /**
-   * Return a RegionLocation from the parsed Response
-   */
-  std::shared_ptr<RegionLocation> CreateLocation(const Response &resp,
-                                                 const hbase::pb::TableName &tn);
-
-  /**
-   * Return whether the table is the meta table.
-   */
-  static bool IsMeta(const hbase::pb::TableName &tn);
-
-  const pb::RegionInfo &meta_region_info() const { return meta_region_info_; }
-
- private:
-  pb::RegionInfo meta_region_info_;
-};
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/multi-response.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/multi-response.cc b/hbase-native-client/core/multi-response.cc
deleted file mode 100644
index a4c2108..0000000
--- a/hbase-native-client/core/multi-response.cc
+++ /dev/null
@@ -1,86 +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/multi-response.h"
-#include <glog/logging.h>
-#include "core/region-result.h"
-
-using hbase::pb::RegionLoadStats;
-
-namespace hbase {
-
-MultiResponse::MultiResponse() {}
-
-int MultiResponse::Size() const {
-  int size = 0;
-  for (const auto& result : results_) {
-    size += result.second->ResultOrExceptionSize();
-  }
-  return size;
-}
-
-void MultiResponse::AddRegionResult(const std::string& region_name, int32_t original_index,
-                                    std::shared_ptr<Result> result,
-                                    std::shared_ptr<folly::exception_wrapper> exc) {
-  auto itr = results_.find(region_name);
-  if (itr == results_.end()) {
-    auto region_result = std::make_shared<RegionResult>();
-    region_result->AddResultOrException(original_index, result, exc);
-    results_[region_name] = region_result;
-  } else {
-    itr->second->AddResultOrException(original_index, result, exc);
-  }
-}
-
-void MultiResponse::AddRegionException(const std::string& region_name,
-                                       std::shared_ptr<folly::exception_wrapper> exception) {
-  VLOG(8) << "Store Region Exception:- " << exception->what() << "; Region[" << region_name << "];";
-  bool region_found = false;
-  auto itr = exceptions_.find(region_name);
-  if (itr == exceptions_.end()) {
-    auto region_result = std::make_shared<folly::exception_wrapper>();
-    exceptions_[region_name] = exception;
-  } else {
-    itr->second = exception;
-  }
-}
-
-std::shared_ptr<folly::exception_wrapper> MultiResponse::RegionException(
-    const std::string& region_name) const {
-  auto find = exceptions_.at(region_name);
-  return find;
-}
-
-const std::map<std::string, std::shared_ptr<folly::exception_wrapper> >&
-MultiResponse::RegionExceptions() const {
-  return exceptions_;
-}
-
-void MultiResponse::AddStatistic(const std::string& region_name,
-                                 std::shared_ptr<RegionLoadStats> stat) {
-  results_[region_name]->set_stat(stat);
-}
-
-const std::map<std::string, std::shared_ptr<RegionResult> >& MultiResponse::RegionResults() const {
-  return results_;
-}
-
-MultiResponse::~MultiResponse() {}
-
-} /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/multi-response.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/multi-response.h b/hbase-native-client/core/multi-response.h
deleted file mode 100644
index d38cfd6..0000000
--- a/hbase-native-client/core/multi-response.h
+++ /dev/null
@@ -1,79 +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 <core/region-result.h>
-#include <folly/ExceptionWrapper.h>
-#include <exception>
-#include <map>
-#include <memory>
-#include <string>
-
-#include "core/result.h"
-#include "if/Client.pb.h"
-
-namespace hbase {
-
-class MultiResponse {
- public:
-  MultiResponse();
-  /**
-   * @brief Returns Number of pairs in this container
-   */
-  int Size() const;
-
-  /**
-   * Add the pair to the container, grouped by the regionName
-   *
-   * @param regionName
-   * @param originalIndex the original index of the Action (request).
-   * @param resOrEx the result or error; will be empty for successful Put and Delete actions.
-   */
-  void AddRegionResult(const std::string& region_name, int32_t original_index,
-                       std::shared_ptr<Result> result,
-                       std::shared_ptr<folly::exception_wrapper> exc);
-
-  void AddRegionException(const std::string& region_name,
-                          std::shared_ptr<folly::exception_wrapper> exception);
-
-  /**
-   * @return the exception for the region, if any. Null otherwise.
-   */
-  std::shared_ptr<folly::exception_wrapper> RegionException(const std::string& region_name) const;
-
-  const std::map<std::string, std::shared_ptr<folly::exception_wrapper>>& RegionExceptions() const;
-
-  void AddStatistic(const std::string& region_name, std::shared_ptr<pb::RegionLoadStats> stat);
-
-  const std::map<std::string, std::shared_ptr<RegionResult>>& RegionResults() const;
-
-  ~MultiResponse();
-
- private:
-  // map of regionName to map of Results by the original index for that Result
-  std::map<std::string, std::shared_ptr<RegionResult>> results_;
-  /**
-   * The server can send us a failure for the region itself, instead of individual failure.
-   * It's a part of the protobuf definition.
-   */
-  std::map<std::string, std::shared_ptr<folly::exception_wrapper>> exceptions_;
-};
-
-} /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/mutation.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/mutation.cc b/hbase-native-client/core/mutation.cc
deleted file mode 100644
index 7182202..0000000
--- a/hbase-native-client/core/mutation.cc
+++ /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.
- *
- */
-
-#include "core/mutation.h"
-#include <algorithm>
-#include <limits>
-#include <stdexcept>
-
-namespace hbase {
-
-Mutation::Mutation(const std::string &row) : Row(row) {}
-Mutation::Mutation(const std::string &row, int64_t timestamp) : Row(row), timestamp_(timestamp) {}
-
-Mutation::Mutation(const Mutation &mutation) {
-  row_ = mutation.row_;
-  durability_ = mutation.durability_;
-  timestamp_ = mutation.timestamp_;
-  for (auto const &e : mutation.family_map_) {
-    for (auto const &c : e.second) {
-      family_map_[e.first].push_back(std::make_unique<Cell>(*c));
-    }
-  }
-}
-
-Mutation &Mutation::operator=(const Mutation &mutation) {
-  row_ = mutation.row_;
-  durability_ = mutation.durability_;
-  timestamp_ = mutation.timestamp_;
-  for (auto const &e : mutation.family_map_) {
-    for (auto const &c : e.second) {
-      family_map_[e.first].push_back(std::make_unique<Cell>(*c));
-    }
-  }
-  return *this;
-}
-
-pb::MutationProto_Durability Mutation::Durability() const { return durability_; }
-
-Mutation &Mutation::SetDurability(pb::MutationProto_Durability durability) {
-  durability_ = durability;
-  return *this;
-}
-
-bool Mutation::HasFamilies() const { return !family_map_.empty(); }
-
-std::unique_ptr<Cell> Mutation::CreateCell(const std::string &family, const std::string &qualifier,
-                                           int64_t timestamp, const std::string &value) {
-  return std::make_unique<Cell>(row_, family, qualifier, timestamp, value, hbase::CellType::PUT);
-}
-
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/mutation.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/mutation.h b/hbase-native-client/core/mutation.h
deleted file mode 100644
index 496891e..0000000
--- a/hbase-native-client/core/mutation.h
+++ /dev/null
@@ -1,96 +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>
-#include <limits>
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-#include "core/cell.h"
-#include "core/row.h"
-#include "if/Client.pb.h"
-
-namespace hbase {
-
-class Mutation : public Row {
- public:
-  /**
-   * Constructors
-   */
-  explicit Mutation(const std::string& row);
-  Mutation(const std::string& row, int64_t timestamp);
-  Mutation(const Mutation& cmutation);
-  Mutation& operator=(const Mutation& cmutation);
-
-  virtual ~Mutation() = default;
-
-  /**
-   * @brief Returns the Mutation family map for this operation.
-   */
-  const std::map<std::string, std::vector<std::unique_ptr<Cell>>>& FamilyMap() const {
-    return family_map_;
-  }
-
-  /**
-   * @brief Returns the timerange for this Get
-   */
-  int64_t TimeStamp() const { return timestamp_; }
-
-  /**
-   * @brief Get versions of columns with the specified timestamp.
-   * @param The timestamp to be set
-   */
-  Mutation& SetTimeStamp(int64_t timestamp) {
-    timestamp_ = timestamp;
-    return *this;
-  }
-
-  /**
-   * @brief Returns true if family map is non empty false otherwise
-   */
-  bool HasFamilies() const;
-
-  /**
-   * @brief Returns the durability level for this Mutation operation
-   */
-  pb::MutationProto_Durability Durability() const;
-
-  /**
-   * @brief Sets the durability level for this Mutation operation
-   * @param durability  the durability to be set
-   */
-  Mutation& SetDurability(pb::MutationProto_Durability durability);
-
- public:
-  static const constexpr int64_t kLatestTimestamp = std::numeric_limits<int64_t>::max();
-
- protected:
-  std::map<std::string, std::vector<std::unique_ptr<Cell>>> family_map_;
-  pb::MutationProto_Durability durability_ =
-      hbase::pb::MutationProto_Durability::MutationProto_Durability_USE_DEFAULT;
-  int64_t timestamp_ = kLatestTimestamp;
-
-  std::unique_ptr<Cell> CreateCell(const std::string& family, const std::string& qualifier,
-                                   int64_t timestamp, const std::string& value);
-};
-
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/put-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/put-test.cc b/hbase-native-client/core/put-test.cc
deleted file mode 100644
index d4ed00a..0000000
--- a/hbase-native-client/core/put-test.cc
+++ /dev/null
@@ -1,135 +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 <glog/logging.h>
-#include <gtest/gtest.h>
-
-#include "core/mutation.h"
-#include "core/put.h"
-#include "utils/time-util.h"
-
-using hbase::Put;
-using hbase::Cell;
-using hbase::CellType;
-using hbase::Mutation;
-using hbase::TimeUtil;
-
-const constexpr int64_t Mutation::kLatestTimestamp;
-
-TEST(Put, Row) {
-  Put put{"foo"};
-  EXPECT_EQ("foo", put.row());
-}
-
-TEST(Put, Durability) {
-  Put put{"row"};
-  EXPECT_EQ(hbase::pb::MutationProto_Durability_USE_DEFAULT, put.Durability());
-
-  auto skipWal = hbase::pb::MutationProto_Durability_SKIP_WAL;
-  put.SetDurability(skipWal);
-  EXPECT_EQ(skipWal, put.Durability());
-}
-
-TEST(Put, Timestamp) {
-  Put put{"row"};
-
-  // test default timestamp
-  EXPECT_EQ(Mutation::kLatestTimestamp, put.TimeStamp());
-
-  // set custom timestamp
-  auto ts = TimeUtil::ToMillis(TimeUtil::GetNowNanos());
-  put.SetTimeStamp(ts);
-  EXPECT_EQ(ts, put.TimeStamp());
-
-  // Add a column with custom timestamp
-  put.AddColumn("f", "q", "v");
-  auto &cell = put.FamilyMap().at("f")[0];
-  EXPECT_EQ(ts, cell->Timestamp());
-}
-
-TEST(Put, HasFamilies) {
-  Put put{"row"};
-
-  EXPECT_EQ(false, put.HasFamilies());
-
-  put.AddColumn("f", "q", "v");
-  EXPECT_EQ(true, put.HasFamilies());
-}
-
-TEST(Put, Add) {
-  CellType cell_type = CellType::PUT;
-  std::string row = "row";
-  std::string family = "family";
-  std::string column = "column";
-  std::string value = "value";
-  int64_t timestamp = std::numeric_limits<int64_t>::max();
-  auto cell = std::make_unique<Cell>(row, family, column, timestamp, value, cell_type);
-
-  // add first cell
-  Put put{"row"};
-  put.Add(std::move(cell));
-  EXPECT_EQ(1, put.FamilyMap().size());
-  EXPECT_EQ(1, put.FamilyMap().at(family).size());
-
-  // add a non-matching row
-  auto cell2 = std::make_unique<Cell>(row, family, column, timestamp, value, cell_type);
-  Put put2{"foo"};
-  ASSERT_THROW(put2.Add(std::move(cell2)), std::runtime_error);  // rows don't match
-
-  // add a second cell with same family
-  auto cell3 = std::make_unique<Cell>(row, family, "column-2", timestamp, value, cell_type);
-  put.Add(std::move(cell3));
-  EXPECT_EQ(1, put.FamilyMap().size());
-  EXPECT_EQ(2, put.FamilyMap().at(family).size());
-
-  // add a cell to a different family
-  auto cell4 = std::make_unique<Cell>(row, "family-2", "column-2", timestamp, value, cell_type);
-  put.Add(std::move(cell4));
-  EXPECT_EQ(2, put.FamilyMap().size());
-  EXPECT_EQ(1, put.FamilyMap().at("family-2").size());
-}
-
-TEST(Put, AddColumn) {
-  std::string row = "row";
-  std::string family = "family";
-  std::string column = "column";
-  std::string value = "value";
-
-  Put put{"row"};
-  put.AddColumn(family, column, value);
-  EXPECT_EQ(1, put.FamilyMap().size());
-  EXPECT_EQ(1, put.FamilyMap().at(family).size());
-
-  // add a second cell with same family
-  put.AddColumn(family, "column-2", value);
-  EXPECT_EQ(1, put.FamilyMap().size());
-  EXPECT_EQ(2, put.FamilyMap().at(family).size());
-
-  // add a cell to a different family
-  put.AddColumn("family-2", column, value);
-  EXPECT_EQ(2, put.FamilyMap().size());
-  EXPECT_EQ(1, put.FamilyMap().at("family-2").size());
-
-  // use the AddColumn overload
-  auto ts = TimeUtil::ToMillis(TimeUtil::GetNowNanos());
-  put.AddColumn(family, column, ts, value);
-  EXPECT_EQ(2, put.FamilyMap().size());
-  EXPECT_EQ(3, put.FamilyMap().at(family).size());
-  auto &cell = put.FamilyMap().at(family)[2];
-  EXPECT_EQ(ts, cell->Timestamp());
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/put.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/put.cc b/hbase-native-client/core/put.cc
deleted file mode 100644
index bb20c5c..0000000
--- a/hbase-native-client/core/put.cc
+++ /dev/null
@@ -1,68 +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/put.h"
-#include <folly/Conv.h>
-#include <algorithm>
-#include <limits>
-#include <stdexcept>
-#include <utility>
-
-namespace hbase {
-
-/**
- *  @brief Add the specified column and value to this Put operation.
- *  @param family family name
- *  @param qualifier column qualifier
- *  @param value column value
- */
-Put& Put::AddColumn(const std::string& family, const std::string& qualifier,
-                    const std::string& value) {
-  return AddColumn(family, qualifier, timestamp_, value);
-}
-
-/**
- *  @brief Add the specified column and value to this Put operation.
- *  @param family family name
- *  @param qualifier column qualifier
- *  @param timestamp version timestamp
- *  @param value column value
- */
-Put& Put::AddColumn(const std::string& family, const std::string& qualifier, int64_t timestamp,
-                    const std::string& value) {
-  if (timestamp < 0) {
-    throw std::runtime_error("Timestamp cannot be negative. ts=" +
-                             folly::to<std::string>(timestamp));
-  }
-
-  return Add(CreateCell(family, qualifier, timestamp, value));
-}
-
-Put& Put::Add(std::unique_ptr<Cell> cell) {
-  if (cell->Row() != row_) {
-    throw std::runtime_error("The row in " + cell->DebugString() +
-                             " doesn't match the original one " + row_);
-  }
-
-  family_map_[cell->Family()].push_back(std::move(cell));
-  return *this;
-}
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/put.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/put.h b/hbase-native-client/core/put.h
deleted file mode 100644
index 8a43dec..0000000
--- a/hbase-native-client/core/put.h
+++ /dev/null
@@ -1,68 +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>
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-#include "core/cell.h"
-#include "core/mutation.h"
-
-namespace hbase {
-
-class Put : public Mutation {
- public:
-  /**
-   * Constructors
-   */
-  explicit Put(const std::string& row) : Mutation(row) {}
-  Put(const std::string& row, int64_t timestamp) : Mutation(row, timestamp) {}
-  Put(const Put& cput) : Mutation(cput) {}
-  Put& operator=(const Put& cput) {
-    Mutation::operator=(cput);
-    return *this;
-  }
-
-  ~Put() = default;
-
-  /**
-   *  @brief Add the specified column and value to this Put operation.
-   *  @param family family name
-   *  @param qualifier column qualifier
-   *  @param value column value
-   */
-  Put& AddColumn(const std::string& family, const std::string& qualifier, const std::string& value);
-
-  /**
-   *  @brief Add the specified column and value to this Put operation.
-   *  @param family family name
-   *  @param qualifier column qualifier
-   *  @param timestamp version timestamp
-   *  @param value column value
-   */
-  Put& AddColumn(const std::string& family, const std::string& qualifier, int64_t timestamp,
-                 const std::string& value);
-
-  Put& Add(std::unique_ptr<Cell> cell);
-};
-
-}  // namespace hbase

http://git-wip-us.apache.org/repos/asf/hbase/blob/128fc306/hbase-native-client/core/query.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/query.h b/hbase-native-client/core/query.h
deleted file mode 100644
index 301f448..0000000
--- a/hbase-native-client/core/query.h
+++ /dev/null
@@ -1,54 +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 "core/filter.h"
-
-namespace hbase {
-
-/**
- * Base class for read RPC calls (Get / Scan).
- */
-class Query {
- public:
-  Query() = default;
-  Query(const Query &query) {
-    // filter can be a custom subclass of Filter, so we do not do a deep copy here.
-    filter_ = query.filter_;
-  }
-
-  Query &operator=(const Query &query) {
-    filter_ = query.filter_;
-    return *this;
-  }
-
-  virtual ~Query() {}
-
-  void SetFilter(std::shared_ptr<Filter> filter) { filter_ = filter; }
-
-  const std::shared_ptr<Filter> filter() const { return filter_; }
-
- protected:
-  std::shared_ptr<Filter> filter_ = nullptr;
-};
-
-}  // namespace hbase


Mime
View raw message