Repository: hbase
Updated Branches:
  refs/heads/HBASE-14850 eec122526 -> 58ec20cac


HBASE-18173 Append class - Addendum to fix formatting


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/58ec20ca
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/58ec20ca
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/58ec20ca

Branch: refs/heads/HBASE-14850
Commit: 58ec20cac0196450f0701817769594371f371653
Parents: eec1225
Author: Enis Soztutar <e...@apache.org>
Authored: Wed Jun 7 17:49:47 2017 -0700
Committer: Enis Soztutar <e...@apache.org>
Committed: Wed Jun 7 17:49:47 2017 -0700

----------------------------------------------------------------------
 hbase-native-client/core/append-test.cc       |  3 +-
 hbase-native-client/core/append.cc            |  5 +-
 hbase-native-client/core/client-test.cc       |  4 +-
 hbase-native-client/core/increment-test.cc    |  2 +-
 hbase-native-client/core/increment.cc         |  7 ++-
 hbase-native-client/core/raw-async-table.cc   | 22 +++++----
 hbase-native-client/core/request-converter.cc | 34 ++++++-------
 hbase-native-client/core/request-converter.h  |  7 +--
 hbase-native-client/utils/bytes-util.cc       | 55 +++++++++++-----------
 9 files changed, 71 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/core/append-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/append-test.cc 
b/hbase-native-client/core/append-test.cc
index 619826c..2216034 100644
--- a/hbase-native-client/core/append-test.cc
+++ b/hbase-native-client/core/append-test.cc
@@ -19,8 +19,8 @@
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
-#include "core/mutation.h"
 #include "core/append.h"
+#include "core/mutation.h"
 #include "utils/time-util.h"
 
 using hbase::Append;
@@ -103,4 +103,3 @@ TEST(Append, Add) {
   EXPECT_EQ(2, append.FamilyMap().size());
   EXPECT_EQ(1, append.FamilyMap().at("family-2").size());
 }
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/core/append.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/append.cc 
b/hbase-native-client/core/append.cc
index 18ee45a..95349ae 100644
--- a/hbase-native-client/core/append.cc
+++ b/hbase-native-client/core/append.cc
@@ -35,10 +35,9 @@ namespace hbase {
  *  @param value value to append
  */
 Append& Append::Add(const std::string& family, const std::string& qualifier,
-        const std::string& value) {
+                    const std::string& value) {
   family_map_[family].push_back(std::move(
-            std::make_unique<Cell>(row_, family, qualifier, timestamp_, value,
-            hbase::CellType::PUT)));
+      std::make_unique<Cell>(row_, family, qualifier, timestamp_, value, 
hbase::CellType::PUT)));
   return *this;
 }
 Append& Append::Add(std::unique_ptr<Cell> cell) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/core/client-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/client-test.cc 
b/hbase-native-client/core/client-test.cc
index 1ee0a83..4972e05 100644
--- a/hbase-native-client/core/client-test.cc
+++ b/hbase-native-client/core/client-test.cc
@@ -25,8 +25,8 @@
 #include "core/configuration.h"
 #include "core/delete.h"
 #include "core/get.h"
-#include "core/increment.h"
 #include "core/hbase-configuration-loader.h"
+#include "core/increment.h"
 #include "core/put.h"
 #include "core/result.h"
 #include "core/table.h"
@@ -244,7 +244,7 @@ TEST_F(ClientTest, Increment) {
   result = table->Increment(hbase::Increment{row}.AddColumn("d", "1", incr2));
 
   EXPECT_EQ(row, result->Row());
-  EXPECT_EQ(incr1+incr2, hbase::BytesUtil::ToInt64(*(result->Value("d", 
"1"))));
+  EXPECT_EQ(incr1 + incr2, hbase::BytesUtil::ToInt64(*(result->Value("d", 
"1"))));
 }
 
 TEST_F(ClientTest, PutGet) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/core/increment-test.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/increment-test.cc 
b/hbase-native-client/core/increment-test.cc
index 3d7b1d4..aa9b864 100644
--- a/hbase-native-client/core/increment-test.cc
+++ b/hbase-native-client/core/increment-test.cc
@@ -19,8 +19,8 @@
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
-#include "core/mutation.h"
 #include "core/increment.h"
+#include "core/mutation.h"
 #include "core/put.h"
 #include "utils/time-util.h"
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/core/increment.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/increment.cc 
b/hbase-native-client/core/increment.cc
index 1a84266..a21a764 100644
--- a/hbase-native-client/core/increment.cc
+++ b/hbase-native-client/core/increment.cc
@@ -38,10 +38,9 @@ namespace hbase {
  *  @param amount amount to increment by
  */
 Increment& Increment::AddColumn(const std::string& family, const std::string& 
qualifier,
-        int64_t amount) {
-  family_map_[family].push_back(std::move(
-            std::make_unique<Cell>(row_, family, qualifier, timestamp_, 
BytesUtil::ToString(amount),
-            hbase::CellType::PUT)));
+                                int64_t amount) {
+  family_map_[family].push_back(std::move(std::make_unique<Cell>(
+      row_, family, qualifier, timestamp_, BytesUtil::ToString(amount), 
hbase::CellType::PUT)));
   return *this;
 }
 Increment& Increment::Add(std::unique_ptr<Cell> cell) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/core/raw-async-table.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/raw-async-table.cc 
b/hbase-native-client/core/raw-async-table.cc
index 2a98d54..413dc6c 100644
--- a/hbase-native-client/core/raw-async-table.cc
+++ b/hbase-native-client/core/raw-async-table.cc
@@ -79,12 +79,15 @@ folly::Future<std::shared_ptr<Result>> 
RawAsyncTable::Get(const hbase::Get& get)
 }
 folly::Future<std::shared_ptr<Result>> RawAsyncTable::Increment(const 
hbase::Increment& incr) {
   auto caller =
-      CreateCallerBuilder<std::shared_ptr<Result>>(incr.row(), 
connection_conf_->write_rpc_timeout())
+      CreateCallerBuilder<std::shared_ptr<Result>>(incr.row(),
+                                                   
connection_conf_->write_rpc_timeout())
           ->action([=, &incr](std::shared_ptr<hbase::HBaseRpcController> 
controller,
-                             std::shared_ptr<hbase::RegionLocation> loc,
-                             std::shared_ptr<hbase::RpcClient> rpc_client) -> 
folly::Future<std::shared_ptr<Result>> {
+                              std::shared_ptr<hbase::RegionLocation> loc,
+                              std::shared_ptr<hbase::RpcClient>
+                                  rpc_client) -> 
folly::Future<std::shared_ptr<Result>> {
             return Call<hbase::Increment, hbase::Request, hbase::Response, 
std::shared_ptr<Result>>(
-                rpc_client, controller, loc, incr, 
&hbase::RequestConverter::IncrementToMutateRequest,
+                rpc_client, controller, loc, incr,
+                &hbase::RequestConverter::IncrementToMutateRequest,
                 &hbase::ResponseConverter::FromMutateResponse);
           })
           ->Build();
@@ -126,12 +129,15 @@ folly::Future<folly::Unit> RawAsyncTable::Delete(const 
hbase::Delete& del) {
 
 folly::Future<std::shared_ptr<Result>> RawAsyncTable::Append(const 
hbase::Append& append) {
   auto caller =
-      CreateCallerBuilder<std::shared_ptr<Result>>(append.row(), 
connection_conf_->write_rpc_timeout())
+      CreateCallerBuilder<std::shared_ptr<Result>>(append.row(),
+                                                   
connection_conf_->write_rpc_timeout())
           ->action([=, &append](std::shared_ptr<hbase::HBaseRpcController> 
controller,
-                             std::shared_ptr<hbase::RegionLocation> loc,
-                             std::shared_ptr<hbase::RpcClient> rpc_client) -> 
folly::Future<std::shared_ptr<Result>> {
+                                std::shared_ptr<hbase::RegionLocation> loc,
+                                std::shared_ptr<hbase::RpcClient>
+                                    rpc_client) -> 
folly::Future<std::shared_ptr<Result>> {
             return Call<hbase::Append, hbase::Request, hbase::Response, 
std::shared_ptr<Result>>(
-                rpc_client, controller, loc, append, 
&hbase::RequestConverter::AppendToMutateRequest,
+                rpc_client, controller, loc, append,
+                &hbase::RequestConverter::AppendToMutateRequest,
                 &hbase::ResponseConverter::FromMutateResponse);
           })
           ->Build();

http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/core/request-converter.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/request-converter.cc 
b/hbase-native-client/core/request-converter.cc
index 54fdfc5..042d5b1 100644
--- a/hbase-native-client/core/request-converter.cc
+++ b/hbase-native-client/core/request-converter.cc
@@ -288,29 +288,29 @@ std::unique_ptr<Request> 
RequestConverter::DeleteToMutateRequest(const Delete &d
   VLOG(3) << "Req is " << pb_req->req_msg()->ShortDebugString();
   return pb_req;
 }
-std::unique_ptr<Request> RequestConverter::IncrementToMutateRequest(const 
Increment &incr,
-        const std::string &region_name) {
-    auto pb_req = Request::mutate();
-    auto pb_msg = 
std::static_pointer_cast<hbase::pb::MutateRequest>(pb_req->req_msg());
-    RequestConverter::SetRegion(region_name, pb_msg->mutable_region());
+std::unique_ptr<Request> RequestConverter::IncrementToMutateRequest(
+    const Increment &incr, const std::string &region_name) {
+  auto pb_req = Request::mutate();
+  auto pb_msg = 
std::static_pointer_cast<hbase::pb::MutateRequest>(pb_req->req_msg());
+  RequestConverter::SetRegion(region_name, pb_msg->mutable_region());
 
-    pb_msg->set_allocated_mutation(
-        ToMutation(MutationType::MutationProto_MutationType_INCREMENT, incr, 
-1).release());
+  pb_msg->set_allocated_mutation(
+      ToMutation(MutationType::MutationProto_MutationType_INCREMENT, incr, 
-1).release());
 
-    VLOG(3) << "Req is " << pb_req->req_msg()->ShortDebugString();
-    return pb_req;
+  VLOG(3) << "Req is " << pb_req->req_msg()->ShortDebugString();
+  return pb_req;
 }
 
 std::unique_ptr<Request> RequestConverter::AppendToMutateRequest(const Append 
&append,
-        const std::string &region_name) {
-    auto pb_req = Request::mutate();
-    auto pb_msg = 
std::static_pointer_cast<hbase::pb::MutateRequest>(pb_req->req_msg());
-    RequestConverter::SetRegion(region_name, pb_msg->mutable_region());
+                                                                 const 
std::string &region_name) {
+  auto pb_req = Request::mutate();
+  auto pb_msg = 
std::static_pointer_cast<hbase::pb::MutateRequest>(pb_req->req_msg());
+  RequestConverter::SetRegion(region_name, pb_msg->mutable_region());
 
-    pb_msg->set_allocated_mutation(
-        ToMutation(MutationType::MutationProto_MutationType_APPEND, append, 
-1).release());
+  pb_msg->set_allocated_mutation(
+      ToMutation(MutationType::MutationProto_MutationType_APPEND, append, 
-1).release());
 
-    VLOG(3) << "Req is " << pb_req->req_msg()->ShortDebugString();
-    return pb_req;
+  VLOG(3) << "Req is " << pb_req->req_msg()->ShortDebugString();
+  return pb_req;
 }
 } /* namespace hbase */

http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/core/request-converter.h
----------------------------------------------------------------------
diff --git a/hbase-native-client/core/request-converter.h 
b/hbase-native-client/core/request-converter.h
index a9d65d6..51440d8 100644
--- a/hbase-native-client/core/request-converter.h
+++ b/hbase-native-client/core/request-converter.h
@@ -24,8 +24,8 @@
 #include <vector>
 #include "connection/request.h"
 #include "core/action.h"
-#include "core/cell.h"
 #include "core/append.h"
+#include "core/cell.h"
 #include "core/delete.h"
 #include "core/get.h"
 #include "core/increment.h"
@@ -85,14 +85,15 @@ class RequestConverter {
   static std::unique_ptr<Request> ToMutateRequest(const Put &put, const 
std::string &region_name);
 
   static std::unique_ptr<Request> IncrementToMutateRequest(const Increment 
&incr,
-          const std::string &region_name);
+                                                           const std::string 
&region_name);
 
   static std::unique_ptr<pb::MutationProto> ToMutation(const MutationType type,
                                                        const Mutation 
&mutation,
                                                        const int64_t nonce);
 
   static std::unique_ptr<Request> AppendToMutateRequest(const Append &append,
-          const std::string &region_name);
+                                                        const std::string 
&region_name);
+
  private:
   // Constructor not required. We have all static methods to create PB 
requests.
   RequestConverter();

http://git-wip-us.apache.org/repos/asf/hbase/blob/58ec20ca/hbase-native-client/utils/bytes-util.cc
----------------------------------------------------------------------
diff --git a/hbase-native-client/utils/bytes-util.cc 
b/hbase-native-client/utils/bytes-util.cc
index e201d55..a937782 100644
--- a/hbase-native-client/utils/bytes-util.cc
+++ b/hbase-native-client/utils/bytes-util.cc
@@ -19,10 +19,10 @@
 
 #include "utils/bytes-util.h"
 
+#include <bits/stdc++.h>
+#include <boost/predef.h>
 #include <memory>
 #include <string>
-#include<bits/stdc++.h>
-#include <boost/predef.h>
 
 #include <glog/logging.h>
 
@@ -31,40 +31,39 @@ namespace hbase {
 constexpr char BytesUtil::kHexChars[];
 
 std::string BytesUtil::ToString(int64_t val) {
-    std::string res;
+  std::string res;
 #if BOOST_ENDIAN_BIG_BYTE || BOOST_ENDIAN_BIG_WORD
-    for (int i = 7; i > 0; i--) {
-      res += (int8_t) (val & 0xffu);
-      val = val >> 8;
-    }
-    res += (int8_t) val;
+  for (int i = 7; i > 0; i--) {
+    res += (int8_t)(val & 0xffu);
+    val = val >> 8;
+  }
+  res += (int8_t)val;
 #else
-    int64_t mask = 0xff00000000000000u;
-    for (int i = 56; i >= 1; i -= 8) {
-        auto num = ((val & mask) >> i);
-        res += num;
-        mask = mask >> 8;
-    }
-    res += (val & 0xff);
+  int64_t mask = 0xff00000000000000u;
+  for (int i = 56; i >= 1; i -= 8) {
+    auto num = ((val & mask) >> i);
+    res += num;
+    mask = mask >> 8;
+  }
+  res += (val & 0xff);
 #endif
-    return res;
+  return res;
 }
 
 int64_t BytesUtil::ToInt64(std::string str) {
-    if (str.length() < 8) {
-      throw std::runtime_error("There are not enough bytes. Expected: 8, 
actual: " + str.length());
-    }
-    const unsigned char *bytes = reinterpret_cast<unsigned char 
*>(const_cast<char*>(str.c_str()));
-    int64_t l = 0;
-    for(int i = 0; i < 8; i++) {
-      l <<= 8;
-      l ^= bytes[i];
-    }
-    return l;
-
+  if (str.length() < 8) {
+    throw std::runtime_error("There are not enough bytes. Expected: 8, actual: 
" + str.length());
+  }
+  const unsigned char *bytes = reinterpret_cast<unsigned char 
*>(const_cast<char *>(str.c_str()));
+  int64_t l = 0;
+  for (int i = 0; i < 8; i++) {
+    l <<= 8;
+    l ^= bytes[i];
+  }
+  return l;
 }
 
-std::string BytesUtil::ToStringBinary(const std::string& b, size_t off, size_t 
len) {
+std::string BytesUtil::ToStringBinary(const std::string &b, size_t off, size_t 
len) {
   std::string result;
   // Just in case we are passed a 'len' that is > buffer length...
   if (off >= b.size()) {

Reply via email to