hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [1/2] hbase git commit: HBASE-17219 [C++] Reformat the code according to the style guidelines - ADDENDUM after HBASE-17395
Date Tue, 17 Jan 2017 01:05:00 GMT
Repository: hbase
Updated Branches:
  refs/heads/HBASE-14850 15a51158f -> fe69c81d0


http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/core/scan.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/scan.cc b/hbase-native-client/core/scan.cc
index 036acfb..5335abd 100644
--- a/hbase-native-client/core/scan.cc
+++ b/hbase-native-client/core/scan.cc
@@ -30,9 +30,7 @@ Scan::Scan() {}
 
 Scan::~Scan() {}
 
-Scan::Scan(const std::string &start_row) : start_row_(start_row) {
-  CheckRow(start_row_);
-}
+Scan::Scan(const std::string &start_row) : start_row_(start_row) { CheckRow(start_row_);
}
 
 Scan::Scan(const std::string &start_row, const std::string &stop_row)
     : start_row_(start_row), stop_row_(stop_row) {
@@ -76,8 +74,7 @@ Scan &Scan::operator=(const Scan &scan) {
 Scan::Scan(const Get &get) {
   cache_blocks_ = get.CacheBlocks();
   max_versions_ = get.MaxVersions();
-  tr_.reset(new TimeRange(get.Timerange().MinTimeStamp(),
-                          get.Timerange().MaxTimeStamp()));
+  tr_.reset(new TimeRange(get.Timerange().MinTimeStamp(), get.Timerange().MaxTimeStamp()));
   family_map_.insert(get.Family().begin(), get.Family().end());
 }
 
@@ -97,8 +94,7 @@ Scan &Scan::AddFamily(const std::string &family) {
 }
 
 Scan &Scan::AddColumn(const std::string &family, const std::string &qualifier)
{
-  const auto &it = std::find(family_map_[family].begin(),
-                             family_map_[family].end(), qualifier);
+  const auto &it = std::find(family_map_[family].begin(), family_map_[family].end(),
qualifier);
   /**
    * Check if any qualifiers are already present or not.
    * Add only if qualifiers for a given family are not present
@@ -156,9 +152,7 @@ void Scan::SetLoadColumnFamiliesOnDemand(bool load_column_families_on_demand)
{
   load_column_families_on_demand_ = load_column_families_on_demand;
 }
 
-bool Scan::LoadColumnFamiliesOnDemand() const {
-  return load_column_families_on_demand_;
-}
+bool Scan::LoadColumnFamiliesOnDemand() const { return load_column_families_on_demand_; }
 
 Scan &Scan::SetMaxVersions(uint32_t max_versions) {
   max_versions_ = max_versions;
@@ -167,9 +161,7 @@ Scan &Scan::SetMaxVersions(uint32_t max_versions) {
 
 int Scan::MaxVersions() const { return max_versions_; }
 
-void Scan::SetMaxResultSize(int64_t max_result_size) {
-  max_result_size_ = max_result_size;
-}
+void Scan::SetMaxResultSize(int64_t max_result_size) { max_result_size_ = max_result_size;
}
 
 int64_t Scan::MaxResultSize() const { return max_result_size_; }
 
@@ -192,8 +184,7 @@ void Scan::CheckRow(const std::string &row) {
     throw std::runtime_error("Row length can't be 0");
   }
   if (row_length > kMaxRowLength) {
-    throw std::runtime_error("Length of " + row +
-                             " is greater than max row size: " +
+    throw std::runtime_error("Length of " + row + " is greater than max row size: " +
                              std::to_string(kMaxRowLength));
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/core/simple-client.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/simple-client.cc b/hbase-native-client/core/simple-client.cc
index f3f6c42..90e7cd4 100644
--- a/hbase-native-client/core/simple-client.cc
+++ b/hbase-native-client/core/simple-client.cc
@@ -65,12 +65,11 @@ std::unique_ptr<Request> MakeRequest(uint64_t col, std::string region_name)
{
   auto suf = folly::to<std::string>(col);
 
   region->set_value(region_name);
-  region->set_type(RegionSpecifier_RegionSpecifierType::
-                       RegionSpecifier_RegionSpecifierType_REGION_NAME);
+  region->set_type(
+      RegionSpecifier_RegionSpecifierType::RegionSpecifier_RegionSpecifierType_REGION_NAME);
   auto mutation = msg->mutable_mutation();
   mutation->set_row(FLAGS_row + suf);
-  mutation->set_mutate_type(
-      MutationProto_MutationType::MutationProto_MutationType_PUT);
+  mutation->set_mutate_type(MutationProto_MutationType::MutationProto_MutationType_PUT);
   auto column = mutation->add_column_value();
   column->set_family("d");
   auto qual = column->add_qualifier_value();
@@ -81,14 +80,12 @@ std::unique_ptr<Request> MakeRequest(uint64_t col, std::string region_name)
{
 }
 
 int main(int argc, char *argv[]) {
-  google::SetUsageMessage(
-      "Simple client to get a single row from HBase on the comamnd line");
+  google::SetUsageMessage("Simple client to get a single row from HBase on the comamnd line");
   google::ParseCommandLineFlags(&argc, &argv, true);
   google::InitGoogleLogging(argv[0]);
 
   // Set up thread pools.
-  auto cpu_pool =
-      std::make_shared<wangle::CPUThreadPoolExecutor>(FLAGS_threads);
+  auto cpu_pool = std::make_shared<wangle::CPUThreadPoolExecutor>(FLAGS_threads);
   auto io_pool = std::make_shared<wangle::IOThreadPoolExecutor>(5);
 
   // Create the cache.
@@ -105,14 +102,13 @@ int main(int argc, char *argv[]) {
   auto results = std::vector<Future<Response>>{};
   auto col = uint64_t{0};
   for (; col < num_puts; col++) {
-    results.push_back(folly::makeFuture(col)
-                          .via(cpu_pool.get())
-                          .then([loc](uint64_t col) {
-                            return MakeRequest(col, loc->region_name());
-                          })
-                          .then([connection](std::unique_ptr<Request> req) {
-                            return (*connection)(std::move(req));
-                          }));
+    results.push_back(
+        folly::makeFuture(col)
+            .via(cpu_pool.get())
+            .then([loc](uint64_t col) { return MakeRequest(col, loc->region_name()); })
+            .then([connection](std::unique_ptr<Request> req) {
+              return (*connection)(std::move(req));
+            }));
   }
   auto allf = folly::collect(results).get();
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/core/time_range.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/time_range.cc b/hbase-native-client/core/time_range.cc
index 8c37b29..04b70ec 100644
--- a/hbase-native-client/core/time_range.cc
+++ b/hbase-native-client/core/time_range.cc
@@ -25,9 +25,7 @@
 namespace hbase {
 
 TimeRange::TimeRange()
-    : min_timestamp_(0L),
-      max_timestamp_(std::numeric_limits<int64_t>::max()),
-      all_time_(true) {}
+    : min_timestamp_(0L), max_timestamp_(std::numeric_limits<int64_t>::max()), all_time_(true)
{}
 
 TimeRange::TimeRange(const TimeRange &tr) {
   this->all_time_ = tr.all_time_;
@@ -53,8 +51,7 @@ TimeRange::TimeRange(int64_t min_timestamp) {
 TimeRange::TimeRange(int64_t min_timestamp, int64_t max_timestamp) {
   if (min_timestamp < 0 || max_timestamp < 0) {
     throw std::runtime_error("Timestamp cannot be negative. min_timestamp: " +
-                             std::to_string(min_timestamp) +
-                             ", max_timestamp:" +
+                             std::to_string(min_timestamp) + ", max_timestamp:" +
                              std::to_string(max_timestamp));
   }
   if (max_timestamp < min_timestamp) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/security/BUCK
----------------------------------------------------------------------
diff --git a/hbase-native-client/security/BUCK b/hbase-native-client/security/BUCK
index 5b935d3..e176c90 100644
--- a/hbase-native-client/security/BUCK
+++ b/hbase-native-client/security/BUCK
@@ -19,12 +19,8 @@
 # to a single server.
 cxx_library(
     name="security",
-    exported_headers=[
-        "user.h",
-    ],
-    srcs=[
-    ],
-    deps=[
-    ],
+    exported_headers=["user.h",],
+    srcs=[],
+    deps=[],
     compiler_flags=['-Weffc++'],
-    visibility=['//core/...','//connection/...'],)
+    visibility=['//core/...', '//connection/...'],)

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/security/user.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/security/user.h b/hbase-native-client/security/user.h
index 795f5ac..8a15891 100644
--- a/hbase-native-client/security/user.h
+++ b/hbase-native-client/security/user.h
@@ -23,16 +23,15 @@
 namespace hbase {
 namespace security {
 class User {
-public:
+ public:
   explicit User(const std::string& user_name) : user_name_(user_name) {}
-  virtual ~User()  = default;
+  virtual ~User() = default;
 
-  std::string user_name() {return user_name_;}
+  std::string user_name() { return user_name_; }
 
-  static std::shared_ptr<User> defaultUser() {
-    return std::make_shared<User>("__drwho");
-  }
-private:
+  static std::shared_ptr<User> defaultUser() { return std::make_shared<User>("__drwho");
}
+
+ private:
   std::string user_name_;
 };
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/serde/client-deserializer-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/serde/client-deserializer-test.cc b/hbase-native-client/serde/client-deserializer-test.cc
index 8c571b1..a30f904 100644
--- a/hbase-native-client/serde/client-deserializer-test.cc
+++ b/hbase-native-client/serde/client-deserializer-test.cc
@@ -50,8 +50,7 @@ TEST(TestRpcSerde, TestGoodGetRequestFullRoundTrip) {
   // fill up the GetRequest.
   in.mutable_region()->set_value("test_region_id");
   in.mutable_region()->set_type(
-      RegionSpecifier_RegionSpecifierType::
-          RegionSpecifier_RegionSpecifierType_ENCODED_REGION_NAME);
+      RegionSpecifier_RegionSpecifierType::RegionSpecifier_RegionSpecifierType_ENCODED_REGION_NAME);
   in.mutable_get()->set_row("test_row");
 
   // Create the buffer

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/serde/rpc.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/serde/rpc.cc b/hbase-native-client/serde/rpc.cc
index e4ade22..3bdb489 100644
--- a/hbase-native-client/serde/rpc.cc
+++ b/hbase-native-client/serde/rpc.cc
@@ -70,15 +70,13 @@ int RpcSerde::ParseDelimited(const IOBuf *buf, Message *msg) {
   coded_stream.PushLimit(msg_size);
   // Parse the message.
   if (msg->MergeFromCodedStream(&coded_stream) == false) {
-    FB_LOG_EVERY_MS(ERROR, 1000)
-        << "Unable to read a protobuf message from data.";
+    FB_LOG_EVERY_MS(ERROR, 1000) << "Unable to read a protobuf message from data.";
     return -4;
   }
 
   // Make sure all the data was consumed.
   if (coded_stream.ConsumedEntireMessage() == false) {
-    FB_LOG_EVERY_MS(ERROR, 1000)
-        << "Orphaned data left after reading protobuf message";
+    FB_LOG_EVERY_MS(ERROR, 1000) << "Orphaned data left after reading protobuf message";
     return -5;
   }
 
@@ -115,8 +113,8 @@ unique_ptr<IOBuf> RpcSerde::Header(const string &user) {
   return PrependLength(SerializeMessage(h));
 }
 
-unique_ptr<IOBuf> RpcSerde::Request(const uint32_t call_id,
-                                    const string &method, const Message *msg) {
+unique_ptr<IOBuf> RpcSerde::Request(const uint32_t call_id, const string &method,
+                                    const Message *msg) {
   pb::RequestHeader rq;
   rq.set_method_name(method);
   rq.set_call_id(call_id);
@@ -169,8 +167,7 @@ unique_ptr<IOBuf> RpcSerde::SerializeDelimited(const Message &msg)
{
   // Now write the rest out.
   // We're using the protobuf output streams here to keep track
   // of where in the output array we are rather than IOBuf.
-  msg.SerializeWithCachedSizesToArray(
-      cos.GetDirectBufferForNBytesAndAdvance(msg_size));
+  msg.SerializeWithCachedSizesToArray(cos.GetDirectBufferForNBytesAndAdvance(msg_size));
 
   // Return the buffer.
   return buf;

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/serde/rpc.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/serde/rpc.h b/hbase-native-client/serde/rpc.h
index 05ceee9..7d060c7 100644
--- a/hbase-native-client/serde/rpc.h
+++ b/hbase-native-client/serde/rpc.h
@@ -83,8 +83,7 @@ class RpcSerde {
    * - RequestHeader object
    * - The passed in Message object
    */
-  std::unique_ptr<folly::IOBuf> Request(const uint32_t call_id,
-                                        const std::string &method,
+  std::unique_ptr<folly::IOBuf> Request(const uint32_t call_id, const std::string &method,
                                         const google::protobuf::Message *msg);
 
   /**
@@ -94,21 +93,18 @@ class RpcSerde {
    * - A protobuf var int32
    * - The message object seriailized after that.
    */
-  std::unique_ptr<folly::IOBuf> SerializeDelimited(
-      const google::protobuf::Message &msg);
+  std::unique_ptr<folly::IOBuf> SerializeDelimited(const google::protobuf::Message
&msg);
 
   /**
    * Serilalize a message. This does not add any length prepend.
    */
-  std::unique_ptr<folly::IOBuf> SerializeMessage(
-      const google::protobuf::Message &msg);
+  std::unique_ptr<folly::IOBuf> SerializeMessage(const google::protobuf::Message &msg);
 
   /**
    * Prepend a length IOBuf to the given IOBuf chain.
    * This involves no copies or moves of the passed in data.
    */
-  std::unique_ptr<folly::IOBuf> PrependLength(
-      std::unique_ptr<folly::IOBuf> msg);
+  std::unique_ptr<folly::IOBuf> PrependLength(std::unique_ptr<folly::IOBuf> msg);
 
  private:
   /* data */

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/serde/server-name-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/serde/server-name-test.cc b/hbase-native-client/serde/server-name-test.cc
index 73a68d6..87c493a 100644
--- a/hbase-native-client/serde/server-name-test.cc
+++ b/hbase-native-client/serde/server-name-test.cc
@@ -37,9 +37,7 @@ TEST(TestServerName, TestIps) {
   ASSERT_EQ(999, sn.port());
 }
 
-TEST(TestServerName, TestThrow) {
-  ASSERT_ANY_THROW(folly::to<ServerName>("Ther's no colon here"));
-}
+TEST(TestServerName, TestThrow) { ASSERT_ANY_THROW(folly::to<ServerName>("Ther's no
colon here")); }
 
 TEST(TestServerName, TestIPV6) {
   auto sn = folly::to<ServerName>("[::::1]:123");

http://git-wip-us.apache.org/repos/asf/hbase/blob/fe69c81d/hbase-native-client/serde/zk.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/serde/zk.cc b/hbase-native-client/serde/zk.cc
index 69b55fa..bf68400 100644
--- a/hbase-native-client/serde/zk.cc
+++ b/hbase-native-client/serde/zk.cc
@@ -46,8 +46,7 @@ bool ZkDeserializer::Parse(IOBuf *buf, Message *out) {
   // There should be a magic number for recoverable zk
   uint8_t magic_num = c.read<uint8_t>();
   if (magic_num != 255) {
-    LOG(ERROR) << "Magic number not in ZK znode data expected 255 got ="
-               << unsigned(magic_num);
+    LOG(ERROR) << "Magic number not in ZK znode data expected 255 got =" << unsigned(magic_num);
     throw runtime_error("Magic number not in znode data");
   }
   // How long is the id?


Mime
View raw message