From b6a632ddd9f4c992788fc9364e3d4d37fedb9feb Mon Sep 17 00:00:00 2001 From: Sudeep Sunthankar Date: Wed, 14 Dec 2016 19:04:35 +1100 Subject: [PATCH] 1) table.h/.cc - Implementation of HTable.java. Will be used to call client operations viz. Get(), Gets(), GetScanner() etc. 2) protobuf_request_builder.h/.cc - Creates PB request object for the corresponding Scan, Get methods. diff --git a/hbase-native-client/core/BUCK b/hbase-native-client/core/BUCK index fa01eb3..057472d 100644 --- a/hbase-native-client/core/BUCK +++ b/hbase-native-client/core/BUCK @@ -32,6 +32,10 @@ cxx_library( "configuration.h", "hbase_configuration_loader.h", "scan.h", + "result.h", + "result_scanner.h", + "protobuf_request_builder.h", + "table.h", ], srcs=[ "cell.cc", @@ -43,6 +47,10 @@ cxx_library( "configuration.cc", "hbase_configuration_loader.cc", "scan.cc", + "result.cc", + "result_scanner.cc", + "protobuf_request_builder.cc", + "table.cc", ], deps=[ "//connection:connection", @@ -53,46 +61,61 @@ cxx_library( "//third-party:zookeeper_mt", ], compiler_flags=['-Weffc++'], - visibility=[ - 'PUBLIC', - ], ) -cxx_test(name="location-cache-test", - srcs=[ - "location-cache-test.cc", + visibility=['PUBLIC', ], ) +cxx_test( + name="location-cache-test", + srcs=["location-cache-test.cc", ], + deps=[ + ":core", + "//test-util:test-util", ], - deps=[":core", - "//test-util:test-util", ], run_test_separately=True, ) -cxx_test(name="cell-test", - srcs=[ - "cell-test.cc", - ], +cxx_test( + name="cell-test", + srcs=["cell-test.cc", ], deps=[":core", ], run_test_separately=True, ) -cxx_test(name="get-test", - srcs=[ - "get-test.cc", - ], +cxx_test( + name="get-test", + srcs=["get-test.cc", ], deps=[":core", ], run_test_separately=True, ) -cxx_test(name="time_range-test", - srcs=[ - "time_range-test.cc", - ], +cxx_test( + name="time_range-test", + srcs=["time_range-test.cc", ], deps=[":core", ], run_test_separately=True, ) -cxx_test(name="hbase_configuration-test", - srcs=[ - "hbase_configuration-test.cc", - ], +cxx_test( + name="hbase_configuration-test", + srcs=["hbase_configuration-test.cc", ], deps=[":core", ], run_test_separately=True, ) -cxx_test(name="scan-test", - srcs=[ - "scan-test.cc", - ], +cxx_test( + name="scan-test", + srcs=["scan-test.cc", ], + deps=[":core", ], + run_test_separately=True, ) +cxx_test( + name="result-test", + srcs=["result-test.cc", ], + deps=[":core", ], + run_test_separately=True, ) +cxx_test( + name="result_scanner-test", + srcs=["result_scanner-test.cc", ], + deps=[":core", ], + run_test_separately=True, ) +cxx_test( + name="protobuf_request_builder-test", + srcs=["protobuf_request_builder-test.cc", ], + deps=[":core", ], + run_test_separately=True, ) +cxx_test( + name="table-test", + srcs=["table-test.cc", ], deps=[":core", ], run_test_separately=True, ) -cxx_binary(name="simple-client", +cxx_binary( + name="simple-client", srcs=["simple-client.cc", ], deps=[":core", "//connection:connection"], ) \ No newline at end of file diff --git a/hbase-native-client/core/protobuf_request_builder-test.cc b/hbase-native-client/core/protobuf_request_builder-test.cc new file mode 100644 index 0000000..90576d1 --- /dev/null +++ b/hbase-native-client/core/protobuf_request_builder-test.cc @@ -0,0 +1,128 @@ +/* + * 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 "protobuf_request_builder.h" + +#include + +#include +#include "connection/request.h" +#include "core/get.h" +#include "core/scan.h" + +using hbase::pb::RegionSpecifier; +using hbase::pb::RegionSpecifier_RegionSpecifierType; + +using hbase::pb::GetRequest; +using hbase::pb::ScanRequest; +using namespace hbase; + +TEST(ProtobufRequestBuilder, Get) { + 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::ProtobufRequestBuilder::BuildGetRequest(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(ProtobufRequestBuilder, Scan) { + 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::ProtobufRequestBuilder::BuildScanRequest(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::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_TRUE(msg->client_handles_partials()); + ASSERT_TRUE(msg->client_handles_heartbeats()); + ASSERT_FALSE(msg->track_scan_metrics()); +} diff --git a/hbase-native-client/core/protobuf_request_builder.cc b/hbase-native-client/core/protobuf_request_builder.cc new file mode 100644 index 0000000..4e10ded --- /dev/null +++ b/hbase-native-client/core/protobuf_request_builder.cc @@ -0,0 +1,121 @@ +/* + * 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 "protobuf_request_builder.h" + +using hbase::Request; + +using hbase::pb::RegionSpecifier_RegionSpecifierType; + +using hbase::pb::GetRequest; +using hbase::pb::ScanRequest; + +namespace hbase { + +ProtobufRequestBuilder::~ProtobufRequestBuilder() { +} + +ProtobufRequestBuilder::ProtobufRequestBuilder() { +} + +void ProtobufRequestBuilder::SetRegion(const std::string ®ion_name, + RegionSpecifier ®ion_specifier) { + + region_specifier.set_type( + hbase::pb::RegionSpecifier_RegionSpecifierType::RegionSpecifier_RegionSpecifierType_REGION_NAME); + region_specifier.set_value(region_name); +} + +std::unique_ptr ProtobufRequestBuilder::BuildGetRequest(const Get& get, + const std::string ®ion_name) { + std::unique_ptr pb_req = std::move(Request::get()); + + auto pb_msg = std::static_pointer_cast < GetRequest > (pb_req->req_msg()); + + ProtobufRequestBuilder::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); + } + } + } + + return std::move(pb_req); +} + +std::unique_ptr ProtobufRequestBuilder::BuildScanRequest(const Scan& scan, + const std::string ®ion_name) { + std::unique_ptr pb_req = std::move(Request::scan()); + + auto pb_msg = std::static_pointer_cast < ScanRequest > (pb_req->req_msg()); + + ProtobufRequestBuilder::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); + } + } + } + + //TODO hardcoding below calues as of now. Should they be overridden? + pb_msg->set_client_handles_partials(true); + pb_msg->set_client_handles_heartbeats(true); + pb_msg->set_track_scan_metrics(false); + + return std::move(pb_req); +} +} /* namespace hbase */ diff --git a/hbase-native-client/core/protobuf_request_builder.h b/hbase-native-client/core/protobuf_request_builder.h new file mode 100644 index 0000000..bc6ad85 --- /dev/null +++ b/hbase-native-client/core/protobuf_request_builder.h @@ -0,0 +1,63 @@ +/* + * 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 +#include + +#include "connection/request.h" +#include "core/get.h" +#include "core/scan.h" + +using hbase::pb::RegionSpecifier; + +namespace hbase { + +class ProtobufRequestBuilder { + public: + ~ProtobufRequestBuilder(); + + /** + * @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 BuildGetRequest(const Get& get, const std::string ®ion_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 BuildScanRequest(const Scan& scan, + const std::string ®ion_name); + private: + // Constructor not rquired. We will have all static methods to create PB requests + ProtobufRequestBuilder(); + + /** + * @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 ®ion_name, RegionSpecifier& region_specifier); +}; + +} /* namespace hbase */ diff --git a/hbase-native-client/core/table-test.cc b/hbase-native-client/core/table-test.cc new file mode 100644 index 0000000..6219ebc --- /dev/null +++ b/hbase-native-client/core/table-test.cc @@ -0,0 +1,82 @@ +/* + * 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/table.h" + +#include + +#include "core/get.h" +#include "core/scan.h" + +using namespace hbase; +using namespace hbase::pb; +using namespace hbase::HTable; + +TEST(Table, Get) { + TableName tn; + tn.set_qualifier("table"); + + Table table = Table(tn); + + hbase::Get get("row"); + get.SetCacheBlocks(false); + get.SetMaxVersions(3); + get.SetTimeRange(10000, 20000); + get.AddFamily("family-1"); + get.AddFamily("family-2"); + get.AddColumn("family-2", "qualifier-1"); + get.AddColumn("family-2", "qualifier-2"); + get.AddColumn("family-2", ""); + get.AddColumn("family-2", "qualifier-3"); + get.SetCacheBlocks(false); + get.SetConsistency(hbase::pb::Consistency::STRONG); + get.SetMaxVersions(2); + get.SetMaxVersions(); + get.SetTimeRange(1000, 2000); + + ASSERT_FALSE(table.Get(get)); +} + +TEST(Table, Scan) { + TableName tn; + tn.set_qualifier("table"); + + Table table = Table(tn); + + std::string start_row("start-row"); + std::string stop_row("stop-row"); + hbase::Scan scan; + scan.SetReversed(true); + scan.SetStartRow(start_row); + scan.SetStopRow(stop_row); + scan.SetSmall(true); + scan.SetCaching(3); + scan.SetConsistency(hbase::pb::Consistency::STRONG); + scan.SetCacheBlocks(true); + scan.SetAllowPartialResults(true); + scan.SetLoadColumnFamiliesOnDemand(true); + scan.SetMaxVersions(5); + scan.SetTimeRange(1000, 2000); + + ASSERT_FALSE(table.GetScanner(scan)); + + ASSERT_FALSE(table.GetScanner("family")); + + ASSERT_FALSE(table.GetScanner("family", "qualifier")); +} diff --git a/hbase-native-client/core/table.cc b/hbase-native-client/core/table.cc new file mode 100644 index 0000000..0383545 --- /dev/null +++ b/hbase-native-client/core/table.cc @@ -0,0 +1,118 @@ +/* + * 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 "table.h" + +#include + +#include "core/protobuf_request_builder.h" + +namespace hbase { + +namespace HTable { + +Table::Table(const TableName &table_name) + : table_name_(new TableName(table_name)), + client_retries_(((*conf).GetInt("hbase.client.retries", 5))), + scanner_caching_( + ((*conf).GetInt("hbase.client.scanner.caching", std::numeric_limits::max()))), + scanner_max_result_size_( + ((*conf).GetLong("hbase.client.scanner.max.result.size", 2 * 1024 * 1024))) { +} + +Table::~Table() { +} + +Table::Table(const Table& table) { + table_name_.reset(new TableName(*table.table_name_)); + cleanup_connection_on_close_ = table.cleanup_connection_on_close_; + is_closed_ = table.is_closed_; + client_retries_ = table.client_retries_; + scanner_caching_ = table.scanner_caching_; + scanner_max_result_size_ = table.scanner_max_result_size_; +} + +Table& Table::operator =(const Table& table) { + table_name_.reset(new TableName(*table.table_name_)); + cleanup_connection_on_close_ = table.cleanup_connection_on_close_; + is_closed_ = table.is_closed_; + client_retries_ = table.client_retries_; + scanner_caching_ = table.scanner_caching_; + scanner_max_result_size_ = table.scanner_max_result_size_; + + return *this; +} + +Result* Table::Get(const hbase::Get& get) { + Result *result = nullptr; + + //TODO check if consistency is STRONG or TIMELINE and fire Get() on replicas if TIMELINE + //TODO As of now hardcoded the region name. Have to use a connection object to find out the region. + std::string region_name("RegionName"); + auto req = hbase::ProtobufRequestBuilder::BuildGetRequest(get, region_name); + return result; +} + +ResultScanner* Table::GetScanner(const hbase::Scan& scan) { + ResultScanner *result_scanner = nullptr; + Scan htable_scan(scan); + if (htable_scan.Caching() <= 0) { + htable_scan.SetCaching(scanner_caching_); + } + if (htable_scan.MaxResultSize() <= 0) { + htable_scan.SetMaxResultSize(scanner_max_result_size_); + } + + //TODO Empty placeholders as of now. + if (htable_scan.IsReversed()) { + if (htable_scan.IsSmall()) { + ; + } else { + ; + } + } else { + if (htable_scan.IsSmall()) { + ; + } else { + ; + } + } + + //TODO Region name determination. + std::string region_name("RegionName"); + auto req = hbase::ProtobufRequestBuilder::BuildScanRequest(htable_scan, region_name); + return result_scanner; +} + +ResultScanner* Table::GetScanner(const std::string& family) { + ResultScanner *result_scanner = nullptr; + Scan scan; + scan.AddFamily(family); + return GetScanner(scan); +} + +ResultScanner* Table::GetScanner(const std::string& family, const std::string& qualifier) { + ResultScanner *result_scanner = nullptr; + Scan scan; + scan.AddColumn(family, qualifier); + return GetScanner(scan); +} + +} /* namespace HTable */ +} /* namespace hbase */ diff --git a/hbase-native-client/core/table.h b/hbase-native-client/core/table.h new file mode 100644 index 0000000..fb0e12c --- /dev/null +++ b/hbase-native-client/core/table.h @@ -0,0 +1,94 @@ +/* + * 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 +#include + +#include "core/cell.h" +#include "core/configuration.h" +#include "core/hbase_configuration_loader.h" +#include "core/get.h" +#include "core/scan.h" +#include "core/result.h" +#include "core/result_scanner.h" +#include "serde/table-name.h" + +using namespace hbase::pb; + +namespace hbase { + +namespace HTable { + +class Table { + public: + /** + * Constructors + */ + Table(const TableName &table_name); + Table(const Table &table); + Table& operator=(const Table &table); + ~Table(); + + /** + * @brief - Returns a Result object for the constructed Get. + * @param - get Get object to perform HBase Get operation. + */ + Result* Get(const hbase::Get &get); + + /** + * @brief - Returns a list of Result objects for the coresponding Get object in gets. + * @param - gets vector consisting of the Get objects for fetching results. This is a multi-get operation. + */ + std::vector> Get(const std::vector& gets); + + /** + * @brief - Returns ResultScanner for the constructed Scan. + * @param - scan Scan object to perform HBase Scan + */ + ResultScanner* GetScanner(const hbase::Scan & scan); + + /** + * @brief - Returns ResultScanner for the constructed Scan using the passed family. + * @param - family Family string used to construct a Scan object to perform HBase Scan operation. + */ + ResultScanner* GetScanner(const std::string &family); + + /** + * @brief - Returns ResultScanner for the constructed Scan using the passed family and qualifier. + * @param - family Family string used to construct a Scan object to perform HBase Scan operation. + * @param - qualifier Qualifier string used to construct a Scan objectto perform HBase Scan operation. + */ + ResultScanner* GetScanner(const std::string &family, const std::string &qualifier); + + private: + std::unique_ptr table_name_; + HBaseConfigurationLoader loader; + hbase::optional conf = loader.LoadDefaultResources(); + bool cleanup_connection_on_close_ = false; + bool is_closed_ = false; + // default 5 retries. over-ridden in constructor. + int client_retries_ = 5; + // If HBase Scan is to be performed, below values will be set by reading config if not present. + int scanner_caching_; + long scanner_max_result_size_; +}; +} /* namespace HTable */ +} /* namespace hbase */ -- 1.8.3.1