diff --git a/.gitattributes b/.gitattributes
index f03238ebf5d7..9e4b13956500 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -22,4 +22,5 @@
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
-
+*.bat text eol=crlf
+*.cmd text eol=crlf
diff --git a/NOTICE.txt b/NOTICE.txt
index 337c93beafcd..f03367f86154 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -18,3 +18,9 @@ for details: https://github.com/jruby/jruby/blob/master/COPYING
The JRuby community went out of their way to make JRuby compatible with Apache
projects: See https://issues.apache.org/jira/browse/HBASE-3374)
+
+AsyncHBase (https://github.com/OpenTSDB/asynchbase) is a fully asynchronous,
+non-blocking, thread-safe, high-performance HBase client.
+
+Gradle (http://www.gradle.org/) is used to build the native HBase client
+under ASL v2.0. See http://www.gradle.org/license.
diff --git a/hbase-assembly/pom.xml b/hbase-assembly/pom.xml
index 08526425b4b0..08563d0c0e7a 100644
--- a/hbase-assembly/pom.xml
+++ b/hbase-assembly/pom.xml
@@ -107,4 +107,26 @@
${project.version}
+
+
+
+ hbase-native-client
+
+ false
+
+
+
+ org.apache.hbase
+ hbase-native-client
+ ${project.version}
+
+
+ org.hbase
+ asynchbase
+
+
+
+
+
+
diff --git a/hbase-assembly/src/main/assembly/hadoop-two-compat.xml b/hbase-assembly/src/main/assembly/hadoop-two-compat.xml
index f8ebcda458fb..ffe80259149a 100644
--- a/hbase-assembly/src/main/assembly/hadoop-two-compat.xml
+++ b/hbase-assembly/src/main/assembly/hadoop-two-compat.xml
@@ -23,7 +23,7 @@
bin
- tar.gz
+ dirsrc/main/assembly/components.xml
@@ -33,12 +33,17 @@
true
+
+ org.apache.hbase:hbase-native-clientlibfalse
-
+
+ org.apache.hbase:hbase-native-client
+
diff --git a/hbase-native-client/.gitignore b/hbase-native-client/.gitignore
index f14b3be32d3e..dfda88cab5a6 100644
--- a/hbase-native-client/.gitignore
+++ b/hbase-native-client/.gitignore
@@ -1,38 +1,14 @@
-# Compiled Object files
-*.slo
-*.lo
-*.o
-
-# Compiled Dynamic libraries
-*.so
-
-# Compiled Static libraries
-*.lai
-*.la
-*.a
-
-#python
-*.pyc
-
-# CMake Generated Files
-CMakeCache.txt
-CMakeFiles
-Makefile
-cmake_install.CMakeCache
-cmake_install.cmake
-install_manifest.txt
-CTestTestfile.cmake
+.classpath
+.cproject
+.debug_dll
+.debug_exe
+.gradle
+.perf_test
+.project
+.settings
build
-Testing
-
-
-
-# Thirdparty dirs
-
-thirdparty/glog-*
-thirdparty/gtest-*
-thirdparty/gtest
-thirdparty/protobuf-*
-thirdparty/libevent-*
-thirdparty/libev-*
-thirdparty/installed
+gradle-wrapper.properties
+gradle-wrapper.jar
+target
+*~
+*.patch
diff --git a/hbase-native-client/CMakeLists.txt b/hbase-native-client/CMakeLists.txt
deleted file mode 100644
index be872df9c620..000000000000
--- a/hbase-native-client/CMakeLists.txt
+++ /dev/null
@@ -1,153 +0,0 @@
-# Licensed 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.
-
-
-cmake_minimum_required(VERSION 2.6)
-
-# generate CTest input files
-enable_testing()
-
-# where to find cmake modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
-
-# if no build build type is specified, default to debug builds
-if (NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Debug)
-endif(NOT CMAKE_BUILD_TYPE)
-
-STRING(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
-
-set(CXX_COMMON_FLAGS "-Wall -Wextra -std=c++11")
-set(C_COMMON_FLAGS "-Wall -Wextra -std=c11")
-
-set(CXX_FLAGS_DEBUG "-ggdb -g")
-set(C_FLAGS_DEBUG "-ggdb")
-
-set(CXX_FLAGS_FASTDEBUG "-ggdb -O1")
-set(C_FLAGS_FASTDEBUG "-ggdb -O1")
-
-set(CXX_FLAGS_RELEASE "-O3 -g -DNDEBUG -Wno-strict-aliasing")
-set(C_FLAGS_RELEASE "-O3 -g -DNDEBUG -Wno-strict-aliasing")
-
-# if no build build type is specified, default to debug builds
-if (NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Debug)
-endif(NOT CMAKE_BUILD_TYPE)
-
-string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
-
-# Set compile flags based on the build type.
-message("Configured for ${CMAKE_BUILD_TYPE} build (set with cmake -DCMAKE_BUILD_TYPE={release,debug,...})")
-if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
- set(CMAKE_CXX_FLAGS ${CXX_FLAGS_DEBUG})
- set(CMAKE_C_FLAGS ${C_FLAGS_DEBUG})
-elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "FASTDEBUG")
- set(CMAKE_CXX_FLAGS ${CXX_FLAGS_FASTDEBUG})
- set(CMAKE_C_FLAGS ${C_FLAGS_FASTDEBUG})
-elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
- set(CMAKE_CXX_FLAGS ${CXX_FLAGS_RELEASE})
- set(CMAKE_C_FLAGS ${C_FLAGS_RELEASE})
-else()
- message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
-endif ()
-
-set(CMAKE_CXX_FLAGS "${CXX_COMMON_FLAGS} ${CMAKE_CXX_FLAGS}")
-set(CMAKE_C_FLAGS "${C_COMMON_FLAGS} ${CMAKE_C_FLAGS}")
-
-
-# set compile output directory
-string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWERCASE)
-set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE_LOWERCASE}/")
-
-# Link build/latest to the current build directory, to avoid developers
-# accidentally running the latest debug build when in fact they're building
-# release builds.
-file(MAKE_DIRECTORY ${BUILD_OUTPUT_ROOT_DIRECTORY})
-execute_process(COMMAND rm -f ${CMAKE_CURRENT_SOURCE_DIR}/build/latest)
-execute_process(COMMAND ln -sf ${BUILD_OUTPUT_ROOT_DIRECTORY}
- ${CMAKE_CURRENT_SOURCE_DIR}/build/latest)
-
-# where to put generated libraries
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
-set(ARCHIVE_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
-
-# where to put generated binaries
-set(EXECUTABLE_OUTPUT_PATH "${BUILD_OUTPUT_ROOT_DIRECTORY}")
-
-include_directories(src)
-
-#####################
-# Third Party
-#####################
-
-# find boost headers and libs
-set(Boost_DEBUG TRUE)
-set(Boost_USE_MULTITHREADED ON)
-find_package(Boost REQUIRED COMPONENTS thread system-mt)
-include_directories(${Boost_INCLUDE_DIRS})
-
-find_package(Protobuf REQUIRED)
-include_directories(${PROTOBUF_INCLUDE_DIRS})
-add_library(protobuf STATIC IMPORTED)
-set_target_properties(protobuf PROPERTIES IMPORTED_LOCATION "${PROTOBUF_STATIC_LIBRARY}")
-
-find_package(LibEv REQUIRED)
-include_directories(${LIBEV_INCLUDE_DIR})
-add_library(libev STATIC IMPORTED)
-
-
-set(HBASE_LIBS
- ${PROTOBUF}
- ${LIBEV}
- ${Boost_LIBRARIES}
-)
-#########
-# Testing Config
-#########
-
-# find GTest headers and libs
-find_package(GTest REQUIRED)
-include_directories(${GTEST_INCLUDE_DIR})
-add_library(gtest STATIC IMPORTED)
-set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${GTEST_LIBS}")
-
-set(HBASE_TEST_LIBS ${HBASE_LIBS} ${GTEST_LIBS})
-set(HBASE_ASYNC_TEST_LIBS ${HBASE_LIBS} ${GTEST_LIBS} hbase-async)
-set(HBASE_SYNC_TEST_LIBS ${HBASE_LIBS} ${GTEST_LIBS} hbase-sync)
-
-function(ADD_HBASE_ASYNC_TEST TEST_NAME)
- add_executable(${TEST_NAME} ${TEST_NAME}.cc)
- target_link_libraries(${TEST_NAME} ${HBASE_ASYNC_TEST_LIBS})
- add_test(${TEST_NAME} "${EXECUTABLE_OUTPUT_PATH}/${TEST_NAME}")
-endfunction()
-
-
-function(ADD_HBASE_SYNC_TEST TEST_NAME)
- add_executable(${TEST_NAME} ${TEST_NAME}.cc)
- target_link_libraries(${TEST_NAME} ${HBASE_ASYNC_TEST_LIBS})
- add_test(${TEST_NAME} "${EXECUTABLE_OUTPUT_PATH}/${TEST_NAME}")
-endfunction()
-
-
-#####
-# Actual project definition
-#####
-add_subdirectory(src/async)
-add_subdirectory(src/sync)
-
-add_subdirectory(src/core)
-add_subdirectory(src/rpc)
-
-
-add_library(hbase-async SHARED $ $)
-add_library(hbase-sync SHARED $ $)
diff --git a/hbase-native-client/README.md b/hbase-native-client/README.md
index a959ecacc562..68ddd60d64ae 100644
--- a/hbase-native-client/README.md
+++ b/hbase-native-client/README.md
@@ -1,34 +1,58 @@
-# hbase-native-client
-
-Native client for HBase 0.96
-
-This is a C library that implements a
-HBase client. It's thread safe and libEv
-based.
-
-
-## Design Philosphy
-
-Synchronous and Async versions will both be built
-on the same foundation. The core foundation will
-be C++. External users wanting a C library will
-have to choose either async or sync. These
-libraries will be thin veneers ontop of the C++.
-
-We should try and follow pthreads example as much
-as possible:
-
-* Consistent naming.
-* Opaque pointers as types so that binary compat is easy.
-* Simple setup when the defaults are good.
-* Attr structs when lots of paramters could be needed.
-
-
-## Naming
-All public C files will start with hbase_*.{h, cc}. This
-is to keep naming conflicts to a minimum. Anything without
-the hbase_ prefix is assumed to be implementation private.
-
-All C apis and typedefs will be prefixed with hb_.
-
-All typedefs end with _t.
+# libHBase
+
+Native client for Apache HBase
+This is a JNI based, thread safe C library that implements an HBase client.
+
+## Building the native client
+```
+ mvn install -Phbase-native-client -DskipTests
+```
+
+This will build the tarball containing the headers, shared library and the jar
+files in the `target` directory with the following structure.
+
+```
+/
++---bin/
++---conf/
++---include/
+| +--hbase/
++---lib/
+| +---native/
++---src
+ +---examples/
+ | +---async/
+ +---test/
+ +---native/
+ +---common/
+```
+
+The headers can be found under `include` folder while the shared library to link
+against is under `lib/native`.
+
+## Building and Running Unit Tests
+libHBase uses [GTest](https://code.google.com/p/googletest/) as the test framework
+for unit/integration tests. During the build process, it automatically downloads
+and build the GTest. You will need to have `cmake` installed on the build machine
+to build the GTest framwork.
+
+Runnig the unit tests currently requires you to set `LIBHBASE_ZK_QUORUM` to a valid
+HBase Zookeeper quorum. The default is `"localhost:2181"`. This can be either set
+as an environment variable or in [this configuration file](src/test/resources/config.properties).
+```
+LIBHBASE_ZK_QUORUM=":,..." mvn integration-test
+```
+
+## Building Applications with libHBase
+For examples on how to use the APIs, please take a look at [this sample source]
+(src/examples/async/example_async.c).
+
+As the library uses JNI, you will need to have both `libhbase` and `libjvm` shared
+libraries in your application's library search path. The jars required for the
+library can be specified through either of the environment variables `CLASSPATH`
+or `HBASE_LIB_DIR`. Custom JVM options, for example `-Xmx`, etc can be specified
+using the environment variable `LIBHBASE_OPTS`.
+
+## Performance Testing
+A performance test is included with the library which currently support sequential/
+random gets and puts. You can run the tests using this [shell script](bin/perftest.sh).
diff --git a/hbase-native-client/bin/build-all.sh b/hbase-native-client/bin/build-all.sh
deleted file mode 100755
index a3e45dec25e7..000000000000
--- a/hbase-native-client/bin/build-all.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /usr/bin/env bash
-#
-#/**
-# * Copyright The Apache Software Foundation
-# *
-# * 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.
-# */
-
-set -e
-set -x
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-source ${DIR}/hbase-client-env.sh
-
-${DIR}/download-thirdparty.sh
-${DIR}/build-thirdparty.sh
-cd ${HBASE_DIR}
-cmake .
-make clean all
-make test
diff --git a/hbase-native-client/bin/build-thirdparty.sh b/hbase-native-client/bin/build-thirdparty.sh
deleted file mode 100755
index 097c1a447564..000000000000
--- a/hbase-native-client/bin/build-thirdparty.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#! /usr/bin/env bash
-#
-#/**
-# * Copyright The Apache Software Foundation
-# *
-# * 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.
-# */
-
-set -x
-set -e
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-source ${DIR}/../bin/hbase-client-env.sh
-
-# On some systems, autotools installs libraries to lib64 rather than lib. Fix
-# this by setting up lib64 as a symlink to lib. We have to do this step first
-# to handle cases where one third-party library depends on another.
-mkdir -p "${HBASE_PREFIX}/lib"
-cd ${HBASE_PREFIX}
-ln -sf lib "${HBASE_PREFIX}/lib64"
-
-if [ ! -f gtest ]; then
- cd ${HBASE_GTEST_DIR}
- cmake .
- make -j4
- cd ..
- ln -sf ${HBASE_GTEST_DIR} gtest
-fi
-
-if [ ! -f ${HBASE_PREFIX}/lib/libprotobuf.a ]; then
- cd ${HBASE_PROTOBUF_DIR}
- ./configure --with-pic --disable-shared --prefix=${HBASE_PREFIX}
- make -j4 install
-fi
-
-if [ ! -f ${HBASE_PREFIX}/lib/libev.a ]; then
- cd ${HBASE_LIBEV_DIR}
- ./configure --with-pic --disable-shared --prefix=${HBASE_PREFIX}
- make -j4 install
-fi
-
-echo "---------------------"
-echo "Thirdparty dependencies built and installed into $HBASE_PREFIX successfully"
diff --git a/hbase-native-client/bin/download-thirdparty.sh b/hbase-native-client/bin/download-thirdparty.sh
deleted file mode 100755
index db98aae65db8..000000000000
--- a/hbase-native-client/bin/download-thirdparty.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#! /usr/bin/env bash
-#
-#/**
-# * Copyright The Apache Software Foundation
-# *
-# * 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.
-# */
-
-set -x
-set -e
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-source ${DIR}/../bin/hbase-client-env.sh
-
-mkdir -p ${HBASE_TP_DIR}
-cd ${HBASE_TP_DIR}
-
-
-if [ ! -d ${HBASE_GTEST_DIR} ]; then
- echo "Fetching gtest"
- wget -c http://googletest.googlecode.com/files/gtest-${HBASE_GTEST_VERSION}.zip
- unzip gtest-${HBASE_GTEST_VERSION}.zip
- rm gtest-${HBASE_GTEST_VERSION}.zip
-fi
-
-if [ ! -d ${HBASE_PROTOBUF_DIR} ]; then
- echo "Fetching protobuf"
- wget -c http://protobuf.googlecode.com/files/protobuf-${HBASE_PROTOBUF_VERSION}.tar.gz
- tar xzf protobuf-${HBASE_PROTOBUF_VERSION}.tar.gz
- rm protobuf-${HBASE_PROTOBUF_VERSION}.tar.gz
-fi
-
-if [ ! -d $HBASE_LIBEV_DIR ]; then
- echo "Fetching libev"
- wget -c http://dist.schmorp.de/libev/libev-${HBASE_LIBEV_VERSION}.tar.gz
- tar zxf libev-${HBASE_LIBEV_VERSION}.tar.gz
- rm -rf libev-${HBASE_LIBEV_VERSION}.tar.gz
-fi
-
-if [ ! -d $HBASE_PREFIX/bin/cpplint.py ]; then
- echo "Fetching cpplint"
- mkdir -p $HBASE_PREFIX/bin/
- wget -O $HBASE_PREFIX/bin/cpplint.py http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py
- chmod +x $HBASE_PREFIX/bin/cpplint.py
-fi
-
-
-echo "---------------"
-echo "Thirdparty dependencies downloaded successfully"
diff --git a/hbase-native-client/bin/hbase-client-env.sh b/hbase-native-client/bin/hbase-client-env.sh
deleted file mode 100644
index 96763da672e9..000000000000
--- a/hbase-native-client/bin/hbase-client-env.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#! /usr/bin/env bash
-#
-#/**
-# * Copyright The Apache Software Foundation
-# *
-# * 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.
-# */
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to
- # resolve it relative to the path where
- # the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-HBASE_DIR="${DIR}/../"
-HBASE_TP_DIR="${HBASE_DIR}/thirdparty/"
-
-HBASE_PREFIX=$HBASE_TP_DIR/installed
-
-HBASE_GTEST_VERSION=1.7.0
-HBASE_GTEST_DIR=$HBASE_TP_DIR/gtest-$HBASE_GTEST_VERSION
-
-HBASE_PROTOBUF_VERSION=2.5.0
-HBASE_PROTOBUF_DIR=$HBASE_TP_DIR/protobuf-$HBASE_PROTOBUF_VERSION
-
-HBASE_LIBEV_VERSION=4.15
-HBASE_LIBEV_DIR=$HBASE_TP_DIR/libev-$HBASE_LIBEV_VERSION
-
-# use the compiled tools
-export PATH=$HBASE_PREFIX/bin:$PATH
diff --git a/hbase-native-client/bin/perftest.sh b/hbase-native-client/bin/perftest.sh
new file mode 100755
index 000000000000..cbeb72135776
--- /dev/null
+++ b/hbase-native-client/bin/perftest.sh
@@ -0,0 +1,86 @@
+#
+#/**
+# * Copyright The Apache Software Foundation
+# *
+# * 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.
+# */
+function get_canonical_dir() {
+ target="$1"
+
+ canonical_name=`readlink -f ${target} 2>/dev/null`
+ if [[ $? -eq 0 ]]; then
+ canonical_dir=`dirname $canonical_name`
+ echo ${canonical_dir}
+ return
+ fi
+
+ # Mac has no readlink -f
+ cd `dirname ${target}`
+ target=`basename ${target}`
+ # chase down the symlinks
+ while [ -L ${target} ]; do
+ target=`readlink ${target}`
+ cd `dirname ${target}`
+ target=`basename ${target}`
+ done
+ canonical_dir=`pwd -P`
+ ret=${canonical_dir}
+ echo $ret
+}
+bin=$(get_canonical_dir "$0")
+LIBHBASE_HOME=`cd "$bin/..">/dev/null; pwd`
+
+cygwin=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+esac
+
+HBASE_NATIVE_DIR=${LIBHBASE_HOME}/lib/native
+
+HBASE_LIBRARY_PATH="$HBASE_LIBRARY_PATH:${HBASE_NATIVE_DIR}"
+#Add libjvm.so's location
+if [ -d "$JAVA_HOME/jre/lib/amd64/server" ]; then
+ HBASE_LIBRARY_PATH="$HBASE_LIBRARY_PATH:$JAVA_HOME/jre/lib/amd64/server"
+fi
+if [ -d "$JAVA_HOME/jre/lib/i386/server" ]; then
+ HBASE_LIBRARY_PATH="$HBASE_LIBRARY_PATH:$JAVA_HOME/jre/lib/i386/server"
+fi
+LD_LIBRARY_PATH="${HBASE_LIBRARY_PATH#:}"
+
+HBASE_LIB_DIR=${LIBHBASE_HOME}/lib
+
+if $cygwin; then
+ LIBHBASE_HOME=`cygpath -d "$LIBHBASE_HOME"`
+ LD_LIBRARY_PATH=`cygpath -d "$LD_LIBRARY_PATH"`
+ HBASE_NATIVE_DIR=`cygpath -d "$HBASE_NATIVE_DIR"`
+fi
+
+#This is passed to JVM by libhbase
+LIBHBASE_OPTS="${LIBHBASE_OPTS} -Dlibhbase.log.dir=${LIBHBASE_HOME}/logs -Dlibhbase.log.name=perftest-java.log -Dlibhbase.log.level=info -Dlibhbase.logger=RFA"
+LIBHBASE_OPTS="${LIBHBASE_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/ -XX:+UseConcMarkSweepGC -XX:+UseParNewGC"
+
+export LIBHBASE_OPTS=${LIBHBASE_OPTS}
+export HBASE_LIB_DIR=${HBASE_LIB_DIR}
+export HBASE_CONF_DIR=${LIBHBASE_HOME}/conf
+export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
+
+if [ $# -ne 0 ]; then
+ mkdir -p ${LIBHBASE_HOME}/logs
+ LOGFILE_OPTION="-logFilePath ${LIBHBASE_HOME}/logs/perftest.log"
+fi
+
+exec ${HBASE_NATIVE_DIR}/perftest ${LOGFILE_OPTION} $*
diff --git a/hbase-native-client/build.gradle b/hbase-native-client/build.gradle
new file mode 100644
index 000000000000..90e1fc8c4b59
--- /dev/null
+++ b/hbase-native-client/build.gradle
@@ -0,0 +1,263 @@
+/**
+ * Copyright The Apache Software Foundation
+ *
+ * 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.
+ */
+import org.gradle.internal.os.OperatingSystem
+
+apply plugin: 'c'
+apply plugin: 'cpp'
+
+defaultTasks "hbase", "perftest", "example_async", "unittests"
+
+ext {
+ currentJvm = org.gradle.internal.jvm.Jvm.current()
+ javaHome = currentJvm.getJavaHome().getAbsolutePath()
+ javaHomeInclude = javaHome + '/include'
+
+ String osName = System.properties['os.name'].toLowerCase()
+ if (osName.contains('linux')) {
+ javaHomeIncludeOs = javaHomeInclude + '/linux'
+ libjvmLibraryString = javaHome + "/jre/lib/amd64/server/libjvm.so"
+ libGTestName = "/libgtest.so"
+ }
+ else if (osName.contains('windows')) {
+ javaHomeIncludeOs = javaHomeInclude + '/win32'
+ libjvmLibraryString = javaHome + "/lib/jvm.lib"
+ libGTestName = "/cyggtest.dll"
+ }
+ else if (osName.contains('mac os x')) {
+ // TODO - deal with different versions of OSX,
+ // because Apple has done heavy modification to the JVM and JDK every version
+ javaHomeInclude = "/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers"
+ javaHomeIncludeOs = "/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers"
+ libjvmLibraryString = "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libserver.dylib"
+ libGTestName = "/libgtest.dylib"
+ }
+
+ // this should be set to the directory of JNI generated headers
+ if (!project.hasProperty('jniIncludeDir')) {
+ jniIncludeDir = "src/main/native/generated"
+ }
+ if (!project.hasProperty('googleTestDir')) {
+ googleTestDir = "target/gtest-1.7.0"
+ }
+}
+
+def stdout = new ByteArrayOutputStream()
+try {
+ exec {
+ commandLine(
+ "ls", libjvmLibraryString
+ )
+ errorOutput = stdout
+ standardOutput = stdout
+ ignoreExitValue = false
+ logger.info("Using ${libjvmLibraryString} and include directories ${javaHomeInclude} and ${javaHomeIncludeOs}")
+ }
+} catch(e){
+ logger.error(stdout.toString())
+ throw new GradleException("The file ${libjvmLibraryString} was not found")
+}
+
+model {
+ toolChains {
+ // currently only GCC is supported
+ gcc(Gcc) {
+ }
+ }
+
+ buildTypes {
+ release
+ }
+
+ repositories {
+ libs(PrebuiltLibraries) {
+ jvm {
+ binaries.withType(SharedLibraryBinary) {
+ sharedLibraryFile = file(libjvmLibraryString)
+ }
+ }
+
+ gtest {
+ binaries.withType(SharedLibraryBinary) {
+ sharedLibraryFile = file(googleTestDir + libGTestName)
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Verify that JAVA_HOME is set
+ */
+dependencies {
+ if (!javaHome) {
+ logger.error('JAVA_HOME is not set.')
+ throw new GradleException("JAVA_HOME is not set.")
+ }
+ println 'Found JAVA_HOME: ' + javaHome
+}
+
+/**
+ * Register the source files for goals
+ */
+sources {
+ /* libHBase sources */
+ hbase {
+ cpp {
+ source {
+ srcDirs "src/main/native/jni_impl", "src/main/native/common"
+ include "**/*.cc"
+ }
+ exportedHeaders {
+ srcDirs "src/main/native/include", "src/main/native/common", jniIncludeDir,
+ javaHomeInclude, javaHomeIncludeOs
+ }
+ }
+ }
+
+ /* perftest sources */
+ perftest {
+ cpp {
+ source {
+ srcDirs "src/test/native/perftest", "src/test/native/common"
+ include "**/*.cc"
+ }
+ exportedHeaders {
+ srcDirs "src/test/native/common"
+ }
+ }
+ }
+ /* unittests sources */
+ unittests {
+ cpp {
+ source {
+ srcDirs "src/test/native/unittests", "src/test/native/common"
+ include "**/*.cc"
+ }
+ exportedHeaders {
+ srcDirs "src/test/native/common", googleTestDir + "/include"
+ }
+ }
+ }
+
+ /* example_async sources */
+ example_async {
+ cpp {
+ source {
+ srcDirs "src/test/native/common"
+ include "byte_buffer.cc"
+ }
+ exportedHeaders {
+ srcDirs "src/test/native/common"
+ }
+ }
+ c {
+ source {
+ srcDirs "src/examples/async"
+ include "example_async.c"
+ }
+ exportedHeaders {
+ srcDirs "src/test/native/common"
+ }
+ }
+ }
+}
+
+/**
+ * Compiler flags for all targets
+ */
+binaries.all {
+ if (toolChain in Gcc) {
+ cCompiler.args "-Wall", "-Werror", "-fvisibility=hidden", "-std=gnu99"
+ cppCompiler.args "-Wall", "-Werror", "-fvisibility=hidden", "-fvisibility-inlines-hidden"
+
+ lib library: 'jvm', linkage: 'shared'
+ if (OperatingSystem.current().windows) {
+ // Without this, the linker decorate the JNIEXPORTs and then JNI can not find them
+ linker.args "-Wl,--kill-at"
+ }
+ }
+ // TODO: set flags for other compilers
+}
+
+/*
+ * libHBase Shared Library
+ */
+libraries {
+ hbase {
+ binaries.withType(SharedLibraryBinary) {
+ cppCompiler.define "__STDC_FORMAT_MACROS" // for PRIu64 macro
+ cppCompiler.define "_LIBHBASE_IMPLEMENTATION_"
+ cppCompiler.define "THREADED"
+
+ cCompiler.define "_LIBHBASE_IMPLEMENTATION_"
+ cCompiler.define "THREADED"
+ }
+ }
+}
+
+/*
+ * example_async executable
+ */
+executables {
+ perftest {
+ binaries.all {
+ cppCompiler.define "__STDC_FORMAT_MACROS" // for PRIu64 macro
+
+ lib library: 'hbase', linkage: 'shared'
+ }
+ }
+
+ example_async {
+ binaries.all {
+ lib library: 'hbase', linkage: 'shared'
+ }
+ }
+
+ unittests {
+ binaries.all {
+ cppCompiler.args "-std=gnu++0x"
+ lib library: 'hbase', linkage: 'shared'
+ lib library: 'gtest', linkage: 'shared'
+ }
+ }
+}
+
+/*
+ * Build tasks
+ */
+task wrapper(type: Wrapper) {
+ description 'A wrapper which downloads and/or uses Gradle'
+ gradleVersion = '1.12'
+}
+
+task 'hbase' (dependsOn: 'hbaseSharedLibrary') {
+ description 'Builds HBase shared library.'
+}
+
+task 'perftest' (dependsOn: 'perftestExecutable') {
+ description 'Builds perftest executable.'
+}
+
+task 'example_async' (dependsOn: 'example_asyncExecutable') {
+ description 'Builds async example executable.'
+}
+
+task 'unittests' (dependsOn: 'unittestsExecutable') {
+ description 'Builds unittests executable.'
+}
diff --git a/hbase-native-client/cmake_modules/FindGTest.cmake b/hbase-native-client/cmake_modules/FindGTest.cmake
deleted file mode 100644
index 1da689214629..000000000000
--- a/hbase-native-client/cmake_modules/FindGTest.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-# Licensed 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.
-
-
-set( GTEST_INCLUDE_SEARCH
- ${CMAKE_SOURCE_DIR}/thirdparty/gtest/include
-)
-
-set( GTEST_LIB_SEARCH
- ${CMAKE_SOURCE_DIR}/thirdparty/gtest
-)
-
-find_path(GTEST_INCLUDE
- NAMES gtest/gtest.h
- PATHS ${GTEST_INCLUDE_SEARCH}
- NO_DEFAULT_PATH
-)
-
-find_library(GTEST_LIBRARY
- NAMES gtest
- PATHS ${GTEST_LIB_SEARCH}
- NO_DEFAULT_PATH
-)
-
-find_library(GTEST_LIBRARY_MAIN
- NAMES gtest_main
- PATHS ${GTEST_LIB_SEARCH}
- NO_DEFAULT_PATH
-)
-
-if (GTEST_INCLUDE AND GTEST_LIBRARY AND GTEST_LIBRARY_MAIN)
- set(GTEST_LIBS ${GTEST_LIBRARY} ${GTEST_LIBRARY_MAIN})
- set(GTEST_INCLUDE_DIR ${GTEST_INCLUDE})
- set(GTEST_FOUND TRUE)
-endif()
-
-mark_as_advanced(
- GTEST_INCLUDE_DIR
- GTEST_LIBS
-)
diff --git a/hbase-native-client/cmake_modules/FindLibEv.cmake b/hbase-native-client/cmake_modules/FindLibEv.cmake
deleted file mode 100644
index 9a40c17f0b17..000000000000
--- a/hbase-native-client/cmake_modules/FindLibEv.cmake
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed 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.
-
-
-set( LIBEV_INCLUDE_SEARCH
- ${CMAKE_SOURCE_DIR}/thirdparty/installed/include
-)
-
-set( LIBEV_LIB_SEARCH
- ${CMAKE_SOURCE_DIR}/thirdparty/installed/include
-)
-
-find_path(LIBEV_INCLUDE
- NAMES ev++.h
- PATHS ${LIBEV_INCLUDE_SEARCH}
- NO_DEFAULT_PATH
-)
-
-find_library(LIBEV_LIBRARY
- NAMES ev
- PATHS ${LIBEV_LIB_SEARCH}
- NO_DEFAULT_PATH
-)
-
-if (LIBEV_INCLUDE_PATH AND LIBEV_LIBRARY)
- set(LIBEV_LIBS ${LIBEV_LIBRARY})
- set(LIBEV_INCLUDE_DIR ${LIBEV_INCLUDE})
- set(LIBEV_FOUND TRUE)
-endif()
-
-mark_as_advanced(
- LIBEV_INCLUDE_DIR
- LIBEV_LIBS
-)
diff --git a/hbase-native-client/gradle/wrapper/gradle-wrapper.jar b/hbase-native-client/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000000..0087cd3b1865
Binary files /dev/null and b/hbase-native-client/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/hbase-native-client/gradle/wrapper/gradle-wrapper.properties b/hbase-native-client/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000000..ec66b868af29
--- /dev/null
+++ b/hbase-native-client/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,21 @@
+# 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.
+
+#Wed Jun 25 02:52:17 PDT 2014
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
diff --git a/hbase-native-client/gradlew b/hbase-native-client/gradlew
new file mode 100644
index 000000000000..949cf4f0216a
--- /dev/null
+++ b/hbase-native-client/gradlew
@@ -0,0 +1,184 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Copyright 2007 The Apache Software Foundation
+# *
+# * 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.
+# */
+#
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/hbase-native-client/gradlew.bat b/hbase-native-client/gradlew.bat
new file mode 100644
index 000000000000..37248fe5d520
--- /dev/null
+++ b/hbase-native-client/gradlew.bat
@@ -0,0 +1,108 @@
+@if "%DEBUG%" == "" @echo off
+@rem/*
+@rem * Licensed to the Apache Software Foundation (ASF) under one
+@rem * or more contributor license agreements. See the NOTICE file
+@rem * distributed with this work for additional information
+@rem * regarding copyright ownership. The ASF licenses this file
+@rem * to you under the Apache License, Version 2.0 (the
+@rem * "License"); you may not use this file except in compliance
+@rem * with the License. You may obtain a copy of the License at
+@rem *
+@rem * http://www.apache.org/licenses/LICENSE-2.0
+@rem *
+@rem * Unless required by applicable law or agreed to in writing, software
+@rem * distributed under the License is distributed on an "AS IS" BASIS,
+@rem * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem * See the License for the specific language governing permissions and
+@rem * limitations under the License.
+@rem */
+@rem
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/hbase-native-client/pom.xml b/hbase-native-client/pom.xml
new file mode 100644
index 000000000000..afc04f290a6f
--- /dev/null
+++ b/hbase-native-client/pom.xml
@@ -0,0 +1,593 @@
+
+
+
+ 4.0.0
+
+ org.apache.hbase
+ hbase
+ 2.0.0-SNAPSHOT
+ ..
+
+
+ hbase-native-client
+ HBase - Native Library
+
+
+
+
+ mapr public
+ MapR Public Maven Repository
+ http://repository.mapr.com/maven/
+
+ true
+
+
+ true
+
+
+
+
+
+ UTF-8
+ 1.7.0
+ 2d6ec8ccdf5c46b05ba54a9fd1d130d7
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+
+ true
+
+
+
+ com.googlecode.maven-download-plugin
+ maven-download-plugin
+ 1.1.0
+
+
+ download-gtest
+ process-test-resources
+
+ wget
+
+ false
+
+ ${maven.test.skip}
+ http://googletest.googlecode.com/files/gtest-${gtest.version}.zip
+ true
+ ${project.build.directory}
+ ${gtest.md5}
+
+
+
+
+
+ maven-surefire-plugin
+
+
+
+ default-test
+ none
+
+
+ secondPartTestsExecution
+ none
+
+
+
+
+ org.codehaus.mojo
+ native-maven-plugin
+ 1.0-alpha-7
+ true
+
+
+ generate-jni-headers
+ compile
+
+ javah
+
+
+
+ org.apache.hadoop.hbase.jni.CallbackHandlers
+
+ ${project.build.directory}/native/javah
+
+
+
+
+
+
+ maven-assembly-plugin
+
+ gnu
+ false
+ false
+
+ src/assembly/all.xml
+
+
+
+
+ build-tarball
+ package
+
+ single
+
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ build-libhbase-binaries
+ compile
+
+ run
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ build-libhbase-tests
+ test-compile
+
+ run
+
+ false
+
+ ${maven.test.skip}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ run-libhbase-unittests
+ integration-test
+
+ run
+
+ false
+
+ ${maven.test.skip}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+ org.codehaus.mojo
+ native-maven-plugin
+ [1.0-alpha-7,)
+
+ javah
+
+
+
+
+
+
+
+
+
+ com.googlecode.maven-download-plugin
+
+ maven-download-plugin
+ [1.1.0,)
+
+ wget
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.hbase
+ hbase-client
+
+
+ jsp-api-2.1
+ org.mortbay.jetty
+
+
+ commons-el
+ commons-el
+
+
+ commons-httpclient
+ commons-httpclient
+
+
+ commons-cli
+ commons-cli
+
+
+ jsp-2.1
+ org.mortbay.jetty
+
+
+ jetty-util
+ org.mortbay.jetty
+
+
+ jasper-runtime
+ tomcat
+
+
+ core
+ org.eclipse.jdt
+
+
+ jasper-compiler
+ tomcat
+
+
+ jetty
+ org.mortbay.jetty
+
+
+ com.yammer.metrics
+ metrics-core
+
+
+ com.github.stephenc.high-scale-lib
+ high-scale-lib
+
+
+ commons-io
+ commons-io
+
+
+ commons-beanutils
+ commons-beanutils-core
+
+
+ log4j
+ log4j
+
+
+ org.apache.avro
+ avro
+
+
+ org.apache.avro
+ avro-ipc
+
+
+ org.apache.thrift
+ libthrift
+
+
+ org.jruby
+ jruby-complete
+
+
+ org.mortbay.jetty
+ servlet-api-2.5
+
+
+ org.codehaus.jackson
+ jackson-jaxrs
+
+
+ org.codehaus.jackson
+ jackson-xc
+
+
+ org.jamon
+ jamon-runtime
+
+
+ com.google.protobuf
+ protobuf-java
+
+
+ com.sun.jersey
+ jersey-core
+
+
+ com.sun.jersey
+ jersey-json
+
+
+ com.sun.jersey
+ jersey-server
+
+
+ hadoop-mapreduce-client-core
+ org.apache.hadoop
+
+
+ findbugs-annotations
+ com.github.stephenc.findbugs
+
+
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.7.5
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.hbase
+ asynchbase
+ 1.5.0-libhbase-SNAPSHOT
+
+
+ log4j-over-slf4j
+ org.slf4j
+
+
+ guava
+ com.google.guava
+
+
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+ log4j
+ log4j
+
+
+ slf4j-log4j12
+ org.slf4j
+
+
+ jline
+ jline
+
+
+ netty
+ org.jboss.netty
+
+
+
+
+
+
+
+
+
+ hadoop-1.1
+
+
+
+ hadoop.profile1.1
+
+
+
+
+ org.apache.hadoop
+ hadoop-core
+
+
+
+
+
+
+ hadoop-2.0
+
+
+
+ !hadoop.profile
+
+
+
+
+ org.apache.hadoop
+ hadoop-common
+
+
+ javax.servlet.jsp
+ jsp-api
+
+
+ com.sun.jersey
+ jersey-server
+
+
+ javax.servlet
+ servlet-api
+
+
+ tomcat
+ jasper-compiler
+
+
+ tomcat
+ jasper-runtime
+
+
+ jersey-json
+ com.sun.jersey
+
+
+ jersey-core
+ com.sun.jersey
+
+
+ avro
+ org.apache.avro
+
+
+ jetty
+ org.mortbay.jetty
+
+
+ jetty-util
+ org.mortbay.jetty
+
+
+ commons-math3
+ org.apache.commons
+
+
+ commons-compress
+ org.apache.commons
+
+
+ commons-cli
+ commons-cli
+
+
+ jets3t
+ net.java.dev.jets3t
+
+
+ commons-httpclient
+ commons-httpclient
+
+
+ commons-el
+ commons-el
+
+
+ commons-digester
+ commons-digester
+
+
+ commons-io
+ commons-io
+
+
+
+
+ org.apache.hadoop
+ hadoop-auth
+
+
+ httpclient
+ org.apache.httpcomponents
+
+
+
+
+
+
+
+
+ hadoop-3.0
+
+
+ hadoop.profile
+ 3.0
+
+
+
+ 3.0-SNAPSHOT
+
+
+
+ org.apache.hadoop
+ hadoop-common
+
+
+
+
+
+
diff --git a/hbase-native-client/src/assembly/all.xml b/hbase-native-client/src/assembly/all.xml
new file mode 100644
index 000000000000..546a3c48741d
--- /dev/null
+++ b/hbase-native-client/src/assembly/all.xml
@@ -0,0 +1,91 @@
+
+
+ bin
+
+
+ dir
+ tar.gz
+
+ ${project.build.directory}
+ false
+
+
+
+ ${basedir}/*.txt
+
+
+
+ bin
+ 0755
+ 0755
+
+
+ ${project.build.directory}/gradle/binaries/hbaseSharedLibrary
+ 0755
+ 0755
+ lib/native
+
+
+ ${project.build.directory}/gradle/binaries/perftestExecutable
+ 0755
+ 0755
+ lib/native
+
+
+ src/main/resources
+ 0644
+ 0755
+ conf
+
+
+ src/main/native/include
+ 0644
+ 0755
+ include
+
+
+ src/examples
+ 0644
+ 0755
+
+
+ src/test/native/common
+ 0644
+ 0755
+
+
+
+
+ /lib
+ false
+ runtime
+ 0644
+ 0644
+
+ junit:junit
+ org.hamcrest:hamcrest-core
+ com.github.stephenc.findbugs:findbugs-annotations
+
+
+
+
diff --git a/hbase-native-client/src/async/CMakeLists.txt b/hbase-native-client/src/async/CMakeLists.txt
deleted file mode 100644
index c11537cd5ec4..000000000000
--- a/hbase-native-client/src/async/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Licensed 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.
-
-set( ASYNC_SRC
- hbase_admin.cc
- hbase_client.cc
- hbase_connection.cc
- hbase_get.cc
- hbase_mutations.cc
- hbase_result.cc
- hbase_scanner.cc
-)
-
-
-add_library(hasync OBJECT ${ASYNC_SRC})
-
-ADD_HBASE_ASYNC_TEST(mutations-test)
-ADD_HBASE_ASYNC_TEST(get-test)
diff --git a/hbase-native-client/src/async/get-test.cc b/hbase-native-client/src/async/get-test.cc
deleted file mode 100644
index df94ce22ffe0..000000000000
--- a/hbase-native-client/src/async/get-test.cc
+++ /dev/null
@@ -1,59 +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
-
-#include "gtest/gtest.h"
-#include "async/hbase_get.h"
-#include "async/hbase_client.h"
-
-
-pthread_cond_t cv;
-pthread_mutex_t mutex;
-
-TEST(GetTest, TestPut) {
- char tn[] = "T1";
- hb_byte_t row[] = "ROW";
-
- hb_client_t client = NULL;
- hb_get_t get = NULL;
- int32_t s1 = -1;
-
- pthread_cond_init(&cv, NULL);
- pthread_mutex_init(&mutex, NULL);
-
- s1 = hb_client_create(&client, NULL);
- EXPECT_EQ(0, s1);
-
- s1 = hb_get_create(&get);
- EXPECT_EQ(0, s1);
-
- hb_get_set_table(get, tn, 2);
- hb_get_set_row(get, row, 3);
-
- /*
- * TODO:
- * This is currently a NO-OP as there is no CB.
- */
- hb_get_send(client, get, NULL, NULL);
-
- hb_client_destroy(client, NULL, NULL);
-
- EXPECT_EQ(0, s1);
-}
diff --git a/hbase-native-client/src/async/hbase_admin.cc b/hbase-native-client/src/async/hbase_admin.cc
deleted file mode 100644
index 17ff2a72b49c..000000000000
--- a/hbase-native-client/src/async/hbase_admin.cc
+++ /dev/null
@@ -1,57 +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 "async/hbase_admin.h"
-
-#include
-#include
-
-#include "core/admin.h"
-#include "async/hbase_connection.h"
-
-int32_t hb_admin_create(hb_admin_t* admin_ptr,
- hb_connection_t connection) {
- (*admin_ptr) = reinterpret_cast(new Admin());
- return 0;
-}
-
-/*
- * Disconnect the admin releasing any internal objects
- * or connections created in the background.
- */
-int32_t hb_admin_destroy(hb_admin_t admin,
- hb_admin_disconnection_cb cb, void * extra) {
- if (cb)
- cb(0, admin, extra);
- free(admin);
- return 0;
-}
-
-/*
- * See if a table exists.
- */
-int32_t hb_admin_table_exists(hb_admin_t admin,
- char * name_space, size_t name_space_length,
- char * table, size_t table_length,
- hb_admin_table_exists_cb cb, void * extra) {
- if (cb)
- cb(0, admin, name_space, name_space_length,
- table, table_length, true, extra);
- return 0;
-}
diff --git a/hbase-native-client/src/async/hbase_admin.h b/hbase-native-client/src/async/hbase_admin.h
deleted file mode 100644
index f03a83f79f9b..000000000000
--- a/hbase-native-client/src/async/hbase_admin.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef ASYNC_HBASE_ADMIN_H_
-#define ASYNC_HBASE_ADMIN_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#include
-
-#include "core/hbase_macros.h"
-#include "async/hbase_connection.h"
-
-
-typedef void (* hb_admin_disconnection_cb)( int32_t status,
- hb_admin_t admin, void * extra);
-typedef void (* hb_admin_table_exists_cb)(int32_t status, hb_admin_t admin,
- char * name_space, size_t name_space_length,
- char * table, size_t table_length, bool exsists, void * extra);
-
-/**
- * Create a new hb_admin.
- * All fields are initialized to the defaults. If you want to set
- * connection or other properties, set those before calling any
- * RPC functions.
- */
-HBASE_API int32_t hb_admin_create(hb_admin_t* admin_ptr,
- hb_connection_t connection);
-
-/*
- * Disconnect the admin releasing any internal objects
- * or connections created in the background.
- */
-HBASE_API int32_t hb_admin_destroy(hb_admin_t admin,
- hb_admin_disconnection_cb cb, void * extra);
-
-/*
- * See if a table exists.
- */
-HBASE_API int32_t hb_admin_table_exists(hb_admin_t admin,
- char * name_space, size_t name_space_length,
- char * table, size_t table_length,
- hb_admin_table_exists_cb cb, void * extra);
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // ASYNC_HBASE_ADMIN_H_
diff --git a/hbase-native-client/src/async/hbase_client.h b/hbase-native-client/src/async/hbase_client.h
deleted file mode 100644
index 34c3d98bfb7b..000000000000
--- a/hbase-native-client/src/async/hbase_client.h
+++ /dev/null
@@ -1,60 +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.
- *
- */
-
-#ifndef ASYNC_HBASE_CLIENT_H_
-#define ASYNC_HBASE_CLIENT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "core/hbase_macros.h"
-#include "core/hbase_types.h"
-
-/*
- * Client disconnection callback typedef
- *
- * This is called after the connections are closed, but just
- * before the client is freed.
- */
-typedef void (* hb_client_disconnection_cb)( int32_t status,
- hb_client_t client, void * extra);
-
-/**
- * Create an hb_client_t.
- *
- * If connection is null then all defaults will be used.
- */
-HBASE_API int32_t hb_client_create(hb_client_t * client_ptr,
- hb_connection_t connection);
-
-/*
- * Disconnect the client releasing any internal objects
- * or connections created in the background.
- */
-HBASE_API int32_t hb_client_destroy(hb_client_t client,
- hb_client_disconnection_cb cb, void * extra);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // ASYNC_HBASE_CLIENT_H_
-
-
diff --git a/hbase-native-client/src/async/hbase_connection.h b/hbase-native-client/src/async/hbase_connection.h
deleted file mode 100644
index 343f36cf41fa..000000000000
--- a/hbase-native-client/src/async/hbase_connection.h
+++ /dev/null
@@ -1,52 +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.
- *
- */
-
-#ifndef ASYNC_HBASE_CONNECTION_H_
-#define ASYNC_HBASE_CONNECTION_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "core/hbase_macros.h"
-#include "core/hbase_types.h"
-#include "core/hbase_connection_attr.h"
-
-#include
-
-/**
- * Create an hb_connection.
- *
- * if connection_attr is null everything will be left as default
- */
-HBASE_API int32_t hb_connection_create(hb_connection_t * connection_ptr,
- hb_connection_attr_t connection_attr);
-
-/**
- * Destroy the connection and free all resources allocated at creation
- * time.
- */
-HBASE_API int32_t hb_connection_destroy(hb_connection_t connection);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // ASYNC_HBASE_CONNECTION_H_
-
diff --git a/hbase-native-client/src/async/hbase_errno.h b/hbase-native-client/src/async/hbase_errno.h
deleted file mode 100644
index 1698bbdbb634..000000000000
--- a/hbase-native-client/src/async/hbase_errno.h
+++ /dev/null
@@ -1,23 +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.
- *
- */
-
-#ifndef ASYNC_HBASE_ERRNO_H_
-#define ASYNC_HBASE_ERRNO_H_
-
-#endif // ASYNC_HBASE_ERRNO_H_
diff --git a/hbase-native-client/src/async/hbase_get.cc b/hbase-native-client/src/async/hbase_get.cc
deleted file mode 100644
index 32048d81fe64..000000000000
--- a/hbase-native-client/src/async/hbase_get.cc
+++ /dev/null
@@ -1,61 +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 "async/hbase_get.h"
-
-#include
-#include
-
-#include "core/get.h"
-
-int32_t hb_get_create(hb_get_t * get_ptr) {
- (*get_ptr) = reinterpret_cast(new Get());
- if ((*get_ptr) == NULL) {
- return -1;
- }
- return 0;
-}
-
-int32_t hb_get_destroy(hb_get_t get) {
- free(get);
- return 0;
-}
-
-int32_t hb_get_set_row(hb_get_t get, unsigned char * row,
- size_t row_length) {
- return 0;
-}
-
-int32_t hb_get_set_table(hb_get_t get,
- char * table, size_t table_length) {
- return 0;
-}
-
-int32_t hb_get_set_namespace(hb_get_t get,
- char * name_space, size_t name_space_length) {
- return 0;
-}
-
-int32_t hb_get_send(hb_client_t client,
- hb_get_t get, hb_get_cb cb, void * extra) {
- if (cb) {
- cb(0, client, get, NULL, extra);
- }
- return 0;
-}
diff --git a/hbase-native-client/src/async/hbase_get.h b/hbase-native-client/src/async/hbase_get.h
deleted file mode 100644
index 7d91c08ae7e0..000000000000
--- a/hbase-native-client/src/async/hbase_get.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef ASYNC_HBASE_GET_H_
-#define ASYNC_HBASE_GET_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "core/hbase_macros.h"
-#include "core/hbase_types.h"
-
-/**
- * Allocate a new get structure.
- * Ownership passes to the caller.
- */
-HBASE_API int32_t hb_get_create(hb_get_t * get_ptr);
-
-/**
- * Destroy and free a get structure.
- */
-HBASE_API int32_t hb_get_destroy(hb_get_t get);
-
-/**
- * set the row of this get.
- */
-HBASE_API int32_t hb_get_set_row(hb_get_t get, hb_byte_t * row,
- size_t row_length);
-
-/**
- * Set the table.
- */
-HBASE_API int32_t hb_get_set_table(hb_get_t get,
- char * table, size_t table_length);
-
-/**
- * Set the namespace this get is targeting.
- */
-HBASE_API int32_t hb_get_set_namespace(hb_get_t get,
- char * name_space, size_t name_space_length);
-
-/*
- * get call back typedef.
- */
-typedef void (* hb_get_cb)(int32_t status, hb_client_t client,
- hb_get_t get, hb_result_t results, void * extra);
-
-HBASE_API int32_t hb_get_send(hb_client_t client,
- hb_get_t get, hb_get_cb cb, void * extra);
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // ASYNC_HBASE_GET_H_
diff --git a/hbase-native-client/src/async/hbase_mutations.cc b/hbase-native-client/src/async/hbase_mutations.cc
deleted file mode 100644
index 2456dc0074cb..000000000000
--- a/hbase-native-client/src/async/hbase_mutations.cc
+++ /dev/null
@@ -1,111 +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 "async/hbase_mutations.h"
-
-#include
-
-#include "core/hbase_types.h"
-#include "core/mutation.h"
-#include "core/put.h"
-#include "core/delete.h"
-
-#include "async/hbase_result.h"
-
-extern "C" {
-int32_t hb_put_create(hb_put_t* put_ptr) {
- (*put_ptr) = reinterpret_cast(new Put());
- return 0;
-}
-
-int32_t hb_delete_create(hb_delete_t * delete_ptr) {
- (*delete_ptr) = reinterpret_cast(new Delete());
- return 0;
-}
-
-int32_t hb_increment_create(hb_increment_t * increment_ptr) {
- return 0;
-}
-
-int32_t hb_append_create(hb_append_t * append_ptr) {
- return 0;
-}
-
-int32_t hb_mutation_destroy(hb_mutation_t mutation) {
- return 0;
-}
-
-HBASE_API int32_t hb_mutation_set_namespace(hb_mutation_t mutation,
- char * name_space, size_t name_space_length) {
- Mutation * m = reinterpret_cast(mutation);
- m->set_namespace(name_space, name_space_length);
- return 0;
-}
-
-HBASE_API int32_t hb_mutation_set_table(hb_mutation_t mutation,
- char * table, size_t table_length) {
- Mutation * m = reinterpret_cast(mutation);
- m->set_namespace(table, table_length);
- return 0;
-}
-
-int32_t hb_mutation_set_row(hb_mutation_t mutation,
- unsigned char * rk, size_t row_length) {
- Mutation * m = reinterpret_cast(mutation);
- m->set_row(rk, row_length);
- return 0;
-}
-
-int32_t hb_mutation_set_durability(hb_mutation_t mutation,
- hb_durability_type durability) {
- Mutation * m = reinterpret_cast(mutation);
- m->set_durability(durability);
- return 0;
-}
-
-int32_t hb_put_add_cell(hb_put_t put, hb_cell_t * cell) {
- return 0;
-}
-
-int32_t hb_delete_add_col(hb_increment_t incr,
- unsigned char * family, size_t family_length,
- unsigned char * qual, size_t qual_length) {
- return 0;
-}
-
-int32_t hb_increment_add_value(hb_increment_t incr,
- unsigned char * family, size_t family_length,
- unsigned char * qual, size_t qual_length,
- int64_t ammount) {
- return 0;
-}
-
-int32_t hb_append_add_cell(hb_append_t put, hb_cell_t * cell) {
- return 0;
-}
-
-int32_t hb_mutation_send(hb_client_t client,
- hb_mutation_t mutation, hb_mutation_cb cb,
- void * extra) {
- if (cb) {
- cb(0, client, mutation, NULL, extra);
- }
- return 0;
-}
-} // extern "C"
diff --git a/hbase-native-client/src/async/hbase_mutations.h b/hbase-native-client/src/async/hbase_mutations.h
deleted file mode 100644
index 4000390836fa..000000000000
--- a/hbase-native-client/src/async/hbase_mutations.h
+++ /dev/null
@@ -1,119 +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.
- *
- */
-
-#ifndef ASYNC_HBASE_MUTATIONS_H_
-#define ASYNC_HBASE_MUTATIONS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "core/hbase_types.h"
-#include "async/hbase_result.h"
-
-// Creation methods
-
-/**
- * Create a put.
- * Ownership passes to the caller.
- */
-HBASE_API int32_t hb_put_create(hb_put_t * put_ptr);
-
-/**
- * Create a delete
- * Ownership passes to the caller.
- */
-HBASE_API int32_t hb_delete_create(hb_delete_t * delete_ptr);
-
-/**
- * Create an increment
- * Ownership passes to the caller.
- */
-HBASE_API int32_t hb_increment_create(hb_increment_t * increment_ptr);
-
-/**
- * Create an append
- * Ownership passes to the caller.
- */
-HBASE_API int32_t hb_append_create(hb_append_t * append_ptr);
-
-/**
- * Destroy the mutation.
- * All internal structures are cleaned up. However any backing
- * data structures passed in by the user are not cleaned up.
- */
-HBASE_API int32_t hb_mutation_destroy(hb_mutation_t mutation);
-
-// Shared setters.
-HBASE_API int32_t hb_mutation_set_namespace(hb_mutation_t mutation,
- char * name_space, size_t name_space_length);
-HBASE_API int32_t hb_mutation_set_table(hb_mutation_t mutation,
- char * table, size_t table_length);
-HBASE_API int32_t hb_mutation_set_row(hb_mutation_t mutation,
- unsigned char * rk, size_t row_length);
-HBASE_API int32_t hb_mutation_set_durability(hb_mutation_t mutation,
- hb_durability_type durability);
-
-// Put Setters etc.
-HBASE_API int32_t hb_put_add_cell(hb_put_t put, hb_cell_t * cell);
-
-// Delete
-HBASE_API int32_t hb_delete_add_col(hb_increment_t incr,
- unsigned char * family, size_t family_length,
- unsigned char * qual, size_t qual_length);
-
-// Increment
-HBASE_API int32_t hb_increment_add_value(hb_increment_t incr,
- unsigned char * family, size_t family_length,
- unsigned char * qual, size_t qual_length,
- int64_t ammount);
-
-// Append
-HBASE_API int32_t hb_append_add_cell(hb_append_t put, hb_cell_t * cell);
-
-// Now that the mutations are created and populated
-// The real meat of the client is below.
-
-/*
- * mutation call back typedef
- */
-typedef void (* hb_mutation_cb)(int32_t status,
- hb_client_t client, hb_mutation_t mutation,
- hb_result_t result, void * extra);
-
-/*
- * Queue a single mutation. This mutation will be
- * sent out in the background and can be batched with
- * other requests destined for the same server.
- *
- * The call back will be executed after the response
- * is received from the RegionServer. Even if the
- * mutation was batched with other requests,
- * the call back will be invoked for every mutation
- * individually.
- */
-HBASE_API int32_t hb_mutation_send(hb_client_t client,
- hb_mutation_t mutation, hb_mutation_cb cb,
- void * extra);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // ASYNC_HBASE_MUTATIONS_H_
diff --git a/hbase-native-client/src/async/hbase_result.cc b/hbase-native-client/src/async/hbase_result.cc
deleted file mode 100644
index 9351270d4b32..000000000000
--- a/hbase-native-client/src/async/hbase_result.cc
+++ /dev/null
@@ -1,37 +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 "async/hbase_result.h"
-
-#include "core/hbase_types.h"
-
-int32_t hb_result_get_cells(hb_result_t result,
- hb_cell_t ** cell_ptr, size_t * num_cells) {
- return 0;
-}
-
-int32_t hb_result_get_table(hb_result_t result,
- char ** table, size_t * table_length) {
- return 0;
-}
-
-int32_t hb_result_get_namespace(hb_result_t result,
- char ** name_space, size_t * name_space_length) {
- return 0;
-}
diff --git a/hbase-native-client/src/async/hbase_result.h b/hbase-native-client/src/async/hbase_result.h
deleted file mode 100644
index eecbbb37519a..000000000000
--- a/hbase-native-client/src/async/hbase_result.h
+++ /dev/null
@@ -1,44 +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.
- *
- */
-
-#ifndef ASYNC_HBASE_RESULT_H_
-#define ASYNC_HBASE_RESULT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "core/hbase_macros.h"
-#include "core/hbase_types.h"
-
-HBASE_API int32_t hb_result_destroy(hb_result_t result);
-
-HBASE_API int32_t hb_result_get_cells(hb_result_t result,
- hb_cell_t ** cell_ptr, size_t * num_cells);
-
-HBASE_API int32_t hb_result_get_table(hb_result_t result,
- char ** table, size_t * table_length);
-HBASE_API int32_t hb_result_get_namespace(hb_result_t result,
- char ** name_space, size_t * name_space_length);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // ASYNC_HBASE_RESULT_H_
diff --git a/hbase-native-client/src/async/hbase_scanner.cc b/hbase-native-client/src/async/hbase_scanner.cc
deleted file mode 100644
index 5a8e5557f77f..000000000000
--- a/hbase-native-client/src/async/hbase_scanner.cc
+++ /dev/null
@@ -1,59 +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 "async/hbase_scanner.h"
-
-#include
-
-#include "core/hbase_types.h"
-#include "core/scanner.h"
-
-int32_t hb_scanner_create(hb_scanner_t * scanner_ptr) {
- (*scanner_ptr) = reinterpret_cast(new Scanner());
- return (*scanner_ptr != NULL)?0:1;
-}
-
-HBASE_API int32_t hb_scanner_set_table(hb_scanner_t scanner,
- char * table, size_t table_length) {
- return 0;
-}
-
-HBASE_API int32_t hb_scanner_set_namespace(hb_scanner_t scanner,
- char * name_space, size_t name_space_length) {
- return 0;
-}
-
-int32_t hb_scanner_set_start_row(hb_scanner_t scanner,
- unsigned char * start_row, size_t start_row_length) {
- return 0;
-}
-
-int32_t hb_scanner_set_end_row(hb_scanner_t scanner,
- unsigned char * end_row, size_t end_row_length) {
- return 0;
-}
-
-int32_t hb_scanner_set_cache_size(hb_scanner_t scanner,
- size_t cache_size) {
- return 0;
-}
-
-int32_t hb_scanner_set_num_versions(hb_scanner_t scanner,
- int8_t num_versions) {
- return 0;
-}
diff --git a/hbase-native-client/src/async/hbase_scanner.h b/hbase-native-client/src/async/hbase_scanner.h
deleted file mode 100644
index cd3f54451770..000000000000
--- a/hbase-native-client/src/async/hbase_scanner.h
+++ /dev/null
@@ -1,80 +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.
- *
- */
-
-#ifndef ASYNC_HBASE_SCANNER_H_
-#define ASYNC_HBASE_SCANNER_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "async/hbase_result.h"
-#include "core/hbase_types.h"
-
-HBASE_API int32_t hb_scanner_create(hb_scanner_t * scanner_ptr);
-
-HBASE_API int32_t hb_scanner_set_table(hb_scanner_t scanner,
- char * table, size_t table_length);
-HBASE_API int32_t hb_scanner_set_namespace(hb_scanner_t scanner,
- char * name_space, size_t name_space_length);
-
-HBASE_API int32_t hb_scanner_set_start_row(hb_scanner_t scanner,
- unsigned char * start_row, size_t start_row_length);
-HBASE_API int32_t hb_scanner_set_end_row(hb_scanner_t scanner,
- unsigned char * end_row, size_t end_row_length);
-
-HBASE_API int32_t hb_scanner_set_cache_size(hb_scanner_t scanner,
- size_t cache_size);
-HBASE_API int32_t hb_scanner_set_batch_size(hb_scanner_t scanner,
- size_t batch_size);
-HBASE_API int32_t hb_scanner_set_num_versions(hb_scanner_t scanner,
- int8_t num_versions);
-
-/*
- * Scanner call back typedef.
- *
- * This will be called when initinalization of the scanner
- * is complete. It will also be called when scanner next
- * returns results.
- */
-typedef void (* hb_scanner_cb)(int32_t status,
- hb_client_t client,
- hb_scanner_t scanner,
- hb_result_t results,
- size_t num_results,
- void * extra);
-/*
- * Get the next results from the scanner
- */
-HBASE_API int32_t hb_scanner_next(hb_client_t client,
- hb_scanner_t scanner, hb_scanner_cb cb, void * extra);
-
-/*
- * Close the scanner releasing any local and server side
- * resources held. The call back is fired just before the
- * scanner's memory is freed.
- */
-HBASE_API int32_t hb_scanner_destroy(hb_client_t client,
- hb_scanner_t scanner, hb_scanner_cb cb, void * extra);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // ASYNC_HBASE_SCANNER_H_
diff --git a/hbase-native-client/src/async/mutations-test.cc b/hbase-native-client/src/async/mutations-test.cc
deleted file mode 100644
index be5898ec95d4..000000000000
--- a/hbase-native-client/src/async/mutations-test.cc
+++ /dev/null
@@ -1,102 +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
-
-#include "gtest/gtest.h"
-#include "async/hbase_mutations.h"
-#include "async/hbase_client.h"
-
-pthread_cond_t cv;
-pthread_mutex_t mutex;
-
-bool sent = false;
-
-TEST(ClientTest, EasyTest) {
- EXPECT_EQ(1, 1);
-}
-
-void mutate_cb(int32_t status,
- hb_client_t client, hb_mutation_t mutation,
- hb_result_t result, void * extra) {
-
- // Test Stuff.
- EXPECT_EQ(status, 0);
- EXPECT_TRUE(client != NULL);
- EXPECT_TRUE(mutation != NULL);
-
- pthread_mutex_lock(&mutex);
- sent = true;
- pthread_cond_signal(&cv);
- pthread_mutex_unlock(&mutex);
-}
-
-void wait_send() {
- pthread_mutex_lock(&mutex);
- while (!sent) {
- pthread_cond_wait(&cv, &mutex);
- }
- pthread_mutex_unlock(&mutex);
-}
-
-TEST(MutationTest, TestPut) {
- char tn[] = "T1";
- hb_byte_t row[] = "ROW";
- char fam[] = "D";
- hb_byte_t qual[] = "QUAL";
- hb_byte_t data[] = "Z";
-
- hb_client_t client = NULL;
- hb_put_t put = NULL;
- hb_cell_t cell;
-
- cell.family = fam;
- cell.family_length = 1;
-
- cell.qual = qual;
- cell.qual_length = 4;
-
- cell.value = data;
- cell.value_length = 1;
-
- int32_t status = -1;
-
- status = hb_client_create(&client, NULL);
- EXPECT_EQ(0, status);
-
- hb_put_create(&put);
- hb_mutation_set_table((hb_mutation_t) put, tn, 2);
- hb_mutation_set_row((hb_mutation_t) put, row, 3);
- hb_put_add_cell(put, &cell);
-
- pthread_cond_init(&cv, NULL);
- pthread_mutex_init(&mutex, NULL);
-
- status = hb_mutation_send(client, (hb_mutation_t) put, &mutate_cb, NULL);
- EXPECT_EQ(0, status);
-
- // Now wait a while for things to send.
- wait_send();
- EXPECT_EQ(true, sent);
-
- hb_mutation_destroy((hb_mutation_t *) put);
- hb_client_destroy(client, NULL, NULL);
-
- EXPECT_EQ(0, status);
-}
diff --git a/hbase-native-client/src/core/CMakeLists.txt b/hbase-native-client/src/core/CMakeLists.txt
deleted file mode 100644
index c15f64953104..000000000000
--- a/hbase-native-client/src/core/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed 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.
-
-set( CORE_SRC
- admin.cc
- client.cc
- connection.cc
- get.cc
- mutation.cc
- put.cc
- delete.cc
- scanner.cc
- hbase_connection_attr.cc
-)
-
-
-add_library(hcore OBJECT ${CORE_SRC})
diff --git a/hbase-native-client/src/core/admin.cc b/hbase-native-client/src/core/admin.cc
deleted file mode 100644
index 897e6bf657d4..000000000000
--- a/hbase-native-client/src/core/admin.cc
+++ /dev/null
@@ -1,20 +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/admin.h"
diff --git a/hbase-native-client/src/core/admin.h b/hbase-native-client/src/core/admin.h
deleted file mode 100644
index 624c4ac8925e..000000000000
--- a/hbase-native-client/src/core/admin.h
+++ /dev/null
@@ -1,25 +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.
- *
- */
-
-#ifndef CORE_ADMIN_H_
-#define CORE_ADMIN_H_
-
-class Admin {
-};
-#endif // CORE_ADMIN_H_
diff --git a/hbase-native-client/src/core/client.cc b/hbase-native-client/src/core/client.cc
deleted file mode 100644
index 91c235c7d351..000000000000
--- a/hbase-native-client/src/core/client.cc
+++ /dev/null
@@ -1,20 +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/client.h"
diff --git a/hbase-native-client/src/core/client.h b/hbase-native-client/src/core/client.h
deleted file mode 100644
index 68348a841850..000000000000
--- a/hbase-native-client/src/core/client.h
+++ /dev/null
@@ -1,25 +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.
- *
- */
-
-#ifndef CORE_CLIENT_H_
-#define CORE_CLIENT_H_
-
-class Client {
-};
-#endif // CORE_CLIENT_H_
diff --git a/hbase-native-client/src/core/connection.cc b/hbase-native-client/src/core/connection.cc
deleted file mode 100644
index 099f31d58b20..000000000000
--- a/hbase-native-client/src/core/connection.cc
+++ /dev/null
@@ -1,22 +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/connection.h"
-
-void Connection::set_zk_quorum(char * zk_q) {
- this->zk_quorum = zk_q;
-}
diff --git a/hbase-native-client/src/core/connection.h b/hbase-native-client/src/core/connection.h
deleted file mode 100644
index 463b7b52319c..000000000000
--- a/hbase-native-client/src/core/connection.h
+++ /dev/null
@@ -1,26 +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.
- */
-#ifndef CORE_CONNECTION_H_
-#define CORE_CONNECTION_H_
-
-class Connection {
- char * zk_quorum;
- public:
- void set_zk_quorum(char * zk_q);
-};
-#endif // CORE_CONNECTION_H_
diff --git a/hbase-native-client/src/core/connection_attr.h b/hbase-native-client/src/core/connection_attr.h
deleted file mode 100644
index a7c229e34a11..000000000000
--- a/hbase-native-client/src/core/connection_attr.h
+++ /dev/null
@@ -1,30 +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.
- *
- */
-
-#ifndef CORE_CONNECTION_ATTR_H_
-#define CORE_CONNECTION_ATTR_H_
-
-#include "core/hbase_macros.h"
-#include "core/hbase_types.h"
-
-class ConnectionAttr {
-};
-
-#endif // CORE_CONNECTION_ATTR_H_
-
diff --git a/hbase-native-client/src/core/delete.cc b/hbase-native-client/src/core/delete.cc
deleted file mode 100644
index 695f5bf39c80..000000000000
--- a/hbase-native-client/src/core/delete.cc
+++ /dev/null
@@ -1,22 +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/delete.h"
-
-Delete::~Delete() {
-}
diff --git a/hbase-native-client/src/core/delete.h b/hbase-native-client/src/core/delete.h
deleted file mode 100644
index 5740fd965a42..000000000000
--- a/hbase-native-client/src/core/delete.h
+++ /dev/null
@@ -1,29 +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.
- *
- */
-
-#ifndef CORE_DELETE_H_
-#define CORE_DELETE_H_
-
-#include "core/mutation.h"
-
-class Delete: public Mutation {
- public:
- ~Delete();
-};
-#endif // CORE_DELETE_H_
diff --git a/hbase-native-client/src/core/get.cc b/hbase-native-client/src/core/get.cc
deleted file mode 100644
index 9e11332ebab5..000000000000
--- a/hbase-native-client/src/core/get.cc
+++ /dev/null
@@ -1,20 +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/get.h"
diff --git a/hbase-native-client/src/core/get.h b/hbase-native-client/src/core/get.h
deleted file mode 100644
index 3a9fd286ab51..000000000000
--- a/hbase-native-client/src/core/get.h
+++ /dev/null
@@ -1,26 +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.
- *
- */
-
-#ifndef CORE_GET_H_
-#define CORE_GET_H_
-
-class Get {
-};
-
-#endif // CORE_GET_H_
diff --git a/hbase-native-client/src/core/hbase_connection_attr.h b/hbase-native-client/src/core/hbase_connection_attr.h
deleted file mode 100644
index c73c818a9e03..000000000000
--- a/hbase-native-client/src/core/hbase_connection_attr.h
+++ /dev/null
@@ -1,51 +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.
- *
- */
-
-#ifndef CORE_HBASE_CONNECTION_ATTR_H_
-#define CORE_HBASE_CONNECTION_ATTR_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "core/hbase_macros.h"
-#include "core/hbase_types.h"
-
-#include
-
-HBASE_API int32_t hb_connection_attr_create(hb_connection_attr_t * attr_ptr);
-
-/**
- * Set the zk quorum of a connection that will be created.
- */
-HBASE_API int32_t hb_connection_attr_set_zk_quorum(hb_connection_t connection,
- char * zk_quorum);
-
-/**
- * Set the zk root of a connection that will be created.
- */
-HBASE_API int32_t hb_connection_attr_set_zk_root(hb_connection_t connection,
- char * zk_root);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // CORE_HBASE_CONNECTION_ATTR_H_
-
diff --git a/hbase-native-client/src/core/hbase_macros.h b/hbase-native-client/src/core/hbase_macros.h
deleted file mode 100644
index 71765c826599..000000000000
--- a/hbase-native-client/src/core/hbase_macros.h
+++ /dev/null
@@ -1,60 +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.
- *
- */
-
-#ifndef CORE_HBASE_MACROS_H_
-#define CORE_HBASE_MACROS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * The following code block define API as the tag for exported
- * functions. The library should be compiled with symbols visibility
- * set to hidden by default and only the exported functions should be
- * tagged as HBASE_API.
- *
- * When building the library on Windows, compile with compiler flag
- * "-D_LIBHBASE_IMPLEMENTATION_", whereas when linking application with
- * this library, this compiler flag should not be used.
- */
-#if defined _WIN32 || defined __CYGWIN__
- #ifdef _LIBHBASE_IMPLEMENTATION_
- #define API __declspec(dllexport)
- #else
- #ifdef _LIBHBASE_TEST_
- #define HBASE_API
- #else
- #define HBASE_API __declspec(dllimport)
- #endif
- #endif
-#else
- #if __GNUC__ >= 4
- #define HBASE_API __attribute__ ((visibility ("default")))
- #else
- #define HBASE_API
- #endif
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // CORE_HBASE_MACROS_H_
-
diff --git a/hbase-native-client/src/core/hbase_types.h b/hbase-native-client/src/core/hbase_types.h
deleted file mode 100644
index 8889b92d1d08..000000000000
--- a/hbase-native-client/src/core/hbase_types.h
+++ /dev/null
@@ -1,83 +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.
- *
- */
-
-#ifndef CORE_HBASE_TYPES_H_
-#define CORE_HBASE_TYPES_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#include
-
-typedef unsigned char hb_byte_t;
-
-/*
- * Base kv type.
- */
-typedef struct {
- hb_byte_t* row;
- size_t row_length;
-
- char * family;
- size_t family_length;
-
- hb_byte_t* qual;
- size_t qual_length;
-
- hb_byte_t* value;
- size_t value_length;
-
- uint64_t timestamp;
-} hb_cell_t;
-
-typedef enum {
- DELETE_ONE_VERSION,
- DELETE_MULTIPLE_VERSIONS,
- DELETE_FAMILY,
- DELETE_FAMILY_VERSION
-} hb_delete_type;
-
-typedef enum {
- USE_DEFAULT,
- SKIP_WAL,
- ASYNC_WAL,
- SYNC_WAL,
- HSYNC_WAL
-} hb_durability_type;
-
-typedef void* hb_admin_t;
-typedef void* hb_client_t;
-typedef void* hb_connection_attr_t;
-typedef void* hb_connection_t;
-typedef void* hb_get_t;
-typedef void* hb_mutation_t;
-typedef void* hb_put_t;
-typedef void* hb_delete_t;
-typedef void* hb_increment_t;
-typedef void* hb_append_t;
-typedef void* hb_result_t;
-typedef void* hb_scanner_t;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif // CORE_HBASE_TYPES_H_
diff --git a/hbase-native-client/src/core/mutation.h b/hbase-native-client/src/core/mutation.h
deleted file mode 100644
index e35d59513daf..000000000000
--- a/hbase-native-client/src/core/mutation.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef CORE_MUTATION_H_
-#define CORE_MUTATION_H_
-
-#include
-
-#include "core/hbase_types.h"
-
-class Mutation {
- char * name_space;
- size_t name_space_length;
-
- char * table;
- size_t table_length;
-
- unsigned char * row;
- size_t row_length;
-
- hb_durability_type durability;
- public:
- void set_namespace(char * name_space, size_t name_space_length);
- void set_table(char * table, size_t table_length);
- void set_row(unsigned char * row, size_t row_length);
- void set_durability(hb_durability_type durability);
-
- virtual ~Mutation();
-};
-#endif // CORE_MUTATION_H_
-
-
diff --git a/hbase-native-client/src/core/put.cc b/hbase-native-client/src/core/put.cc
deleted file mode 100644
index 8bedc8bd27ce..000000000000
--- a/hbase-native-client/src/core/put.cc
+++ /dev/null
@@ -1,22 +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"
-
-Put::~Put() {
-}
diff --git a/hbase-native-client/src/core/put.h b/hbase-native-client/src/core/put.h
deleted file mode 100644
index 7bca3e300d3e..000000000000
--- a/hbase-native-client/src/core/put.h
+++ /dev/null
@@ -1,29 +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.
- *
- */
-
-#ifndef CORE_PUT_H_
-#define CORE_PUT_H_
-
-#include "core/mutation.h"
-
-class Put: public Mutation {
- public:
- ~Put();
-};
-#endif // CORE_PUT_H_
diff --git a/hbase-native-client/src/core/scanner.cc b/hbase-native-client/src/core/scanner.cc
deleted file mode 100644
index a10e44442afc..000000000000
--- a/hbase-native-client/src/core/scanner.cc
+++ /dev/null
@@ -1,20 +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/scanner.h"
diff --git a/hbase-native-client/src/core/scanner.h b/hbase-native-client/src/core/scanner.h
deleted file mode 100644
index 257583be6794..000000000000
--- a/hbase-native-client/src/core/scanner.h
+++ /dev/null
@@ -1,25 +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.
- *
- */
-
-#ifndef CORE_SCANNER_H_
-#define CORE_SCANNER_H_
-
-class Scanner {
-};
-#endif // CORE_SCANNER_H_
diff --git a/hbase-native-client/src/examples/async/example_async.c b/hbase-native-client/src/examples/async/example_async.c
new file mode 100644
index 000000000000..6d337bc23898
--- /dev/null
+++ b/hbase-native-client/src/examples/async/example_async.c
@@ -0,0 +1,656 @@
+/**
+* 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.
+*/
+#line 19 "example_async.c" // ensures short filename in logs.
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+/* Found under /libhbase/src/test/native/common */
+#include "byte_buffer.h"
+
+/*
+ * Sample code to illustrate usage of libhbase APIs
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CHECK_API_ERROR(retCode, ...) \
+ HBASE_LOG_MSG((retCode ? HBASE_LOG_LEVEL_ERROR : HBASE_LOG_LEVEL_INFO), \
+ __VA_ARGS__, retCode);
+
+static byte_t *FAMILIES[] = { (byte_t *)"f", (byte_t *)"g" };
+static hb_columndesc HCD[2] = { NULL };
+
+typedef struct cell_data_t_ {
+ bytebuffer value;
+ hb_cell_t *hb_cell;
+ struct cell_data_t_ *next_cell;
+} cell_data_t;
+
+cell_data_t*
+new_cell_data() {
+ cell_data_t *cell_data = (cell_data_t*) calloc(1, sizeof(cell_data_t));
+ cell_data->next_cell = NULL;
+ return cell_data;
+}
+
+typedef struct row_data_t_ {
+ bytebuffer key;
+ struct cell_data_t_ *first_cell;
+} row_data_t;
+
+static void
+release_row_data(row_data_t *row_data) {
+ if (row_data != NULL) {
+ cell_data_t *cell = row_data->first_cell;
+ while (cell) {
+ bytebuffer_free(cell->value);
+ free(cell->hb_cell);
+ cell_data_t *cur_cell = cell;
+ cell = cell->next_cell;
+ free(cur_cell);
+ }
+ bytebuffer_free(row_data->key);
+ free(row_data);
+ }
+}
+
+/**
+ * Put synchronizer and callback
+ */
+static volatile int32_t outstanding_puts_count;
+static pthread_cond_t puts_cv = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t puts_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static void
+put_callback(int32_t err, hb_client_t client,
+ hb_mutation_t mutation, hb_result_t result, void *extra) {
+ row_data_t* row_data = (row_data_t *)extra;
+ HBASE_LOG_INFO("Received put callback for row \'%.*s\', result = %d.",
+ row_data->key->length, row_data->key->buffer, err);
+ release_row_data(row_data);
+ hb_mutation_destroy(mutation);
+
+ pthread_mutex_lock(&puts_mutex);
+ outstanding_puts_count--;
+ if (outstanding_puts_count == 0) {
+ pthread_cond_signal(&puts_cv);
+ }
+ pthread_mutex_unlock(&puts_mutex);
+}
+
+static void
+wait_for_puts() {
+ HBASE_LOG_INFO("Waiting for outstanding puts to complete.");
+ pthread_mutex_lock(&puts_mutex);
+ while (outstanding_puts_count > 0) {
+ pthread_cond_wait(&puts_cv, &puts_mutex);
+ }
+ pthread_mutex_unlock(&puts_mutex);
+ HBASE_LOG_INFO("Put operations completed.");
+}
+
+/**
+ * Flush synchronizer and callback
+ */
+static volatile bool flush_done = false;
+static pthread_cond_t flush_cv = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t flush_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static void
+client_flush_callback(int32_t err,
+ hb_client_t client, void *extra) {
+ HBASE_LOG_INFO("Received client flush callback.");
+ pthread_mutex_lock(&flush_mutex);
+ flush_done = true;
+ pthread_cond_signal(&flush_cv);
+ pthread_mutex_unlock(&flush_mutex);
+}
+
+static void
+wait_for_flush() {
+ HBASE_LOG_INFO("Waiting for flush to complete.");
+ pthread_mutex_lock(&flush_mutex);
+ while (!flush_done) {
+ pthread_cond_wait(&flush_cv, &flush_mutex);
+ }
+ pthread_mutex_unlock(&flush_mutex);
+ HBASE_LOG_INFO("Flush completed.");
+}
+
+static void printRow(const hb_result_t result) {
+ const byte_t *key = NULL;
+ size_t key_len = 0;
+ hb_result_get_key(result, &key, &key_len);
+ size_t cell_count = 0;
+ hb_result_get_cell_count(result, &cell_count);
+ HBASE_LOG_INFO("Row=\'%.*s\', cell count=%d", key_len, key, cell_count);
+ const hb_cell_t **cells;
+ hb_result_get_cells(result, &cells, &cell_count);
+ for (size_t i = 0; i < cell_count; ++i) {
+ HBASE_LOG_INFO(
+ "Cell %d: family=\'%.*s\', qualifier=\'%.*s\', "
+ "value=\'%.*s\', timestamp=%lld.", i,
+ cells[i]->family_len, cells[i]->family,
+ cells[i]->qualifier_len, cells[i]->qualifier,
+ cells[i]->value_len, cells[i]->value, cells[i]->ts);
+ }
+}
+
+/**
+ * Get synchronizer and callback
+ */
+static volatile bool get_done = false;
+static pthread_cond_t get_cv = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t get_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static void
+get_callback(int32_t err, hb_client_t client,
+ hb_get_t get, hb_result_t result, void *extra) {
+ bytebuffer rowKey = (bytebuffer)extra;
+ if (err == 0) {
+ const char *table_name;
+ size_t table_name_len;
+ hb_result_get_table(result, &table_name, &table_name_len);
+ HBASE_LOG_INFO("Received get callback for table=\'%.*s\'.",
+ table_name_len, table_name);
+
+ printRow(result);
+
+ const hb_cell_t *mycell;
+ bytebuffer qualifier = bytebuffer_strcpy("column-a");
+ HBASE_LOG_INFO("Looking up cell for family=\'%s\', qualifier=\'%.*s\'.",
+ FAMILIES[0], qualifier->length, qualifier->buffer);
+ if (hb_result_get_cell(result, FAMILIES[0], 1, qualifier->buffer,
+ qualifier->length, &mycell) == 0) {
+ HBASE_LOG_INFO("Cell found, value=\'%.*s\', timestamp=%lld.",
+ mycell->value_len, mycell->value, mycell->ts);
+ } else {
+ HBASE_LOG_ERROR("Cell not found.");
+ }
+ bytebuffer_free(qualifier);
+ hb_result_destroy(result);
+ } else {
+ HBASE_LOG_ERROR("Get failed with error code: %d.", err);
+ }
+
+ bytebuffer_free(rowKey);
+ hb_get_destroy(get);
+
+ pthread_mutex_lock(&get_mutex);
+ get_done = true;
+ pthread_cond_signal(&get_cv);
+ pthread_mutex_unlock(&get_mutex);
+}
+
+static void
+wait_for_get() {
+ HBASE_LOG_INFO("Waiting for get operation to complete.");
+ pthread_mutex_lock(&get_mutex);
+ while (!get_done) {
+ pthread_cond_wait(&get_cv, &get_mutex);
+ }
+ pthread_mutex_unlock(&get_mutex);
+ HBASE_LOG_INFO("Get operation completed.");
+}
+
+/**
+ * Delete synchronizer and callbacks
+ */
+static volatile bool delete_done = false;
+static pthread_cond_t del_cv = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t del_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static void
+delete_callback(int32_t err, hb_client_t client,
+ hb_mutation_t delete, hb_result_t result, void *extra) {
+ bytebuffer rowKey = (bytebuffer)extra;
+ HBASE_LOG_INFO("Received delete callback for row \'%.*s\', "
+ "result = %d.", rowKey->length, rowKey->buffer, err);
+
+ hb_mutation_destroy(delete);
+ pthread_mutex_lock(&del_mutex);
+ delete_done = true;
+ pthread_cond_signal(&del_cv);
+ pthread_mutex_unlock(&del_mutex);
+}
+
+static void
+wait_for_delete() {
+ HBASE_LOG_INFO("Waiting for delete operation to complete.");
+ pthread_mutex_lock(&del_mutex);
+ while (!delete_done) {
+ pthread_cond_wait(&del_cv, &del_mutex);
+ }
+ pthread_mutex_unlock(&del_mutex);
+ HBASE_LOG_INFO("Delete operation completed.");
+}
+
+/**
+ * Scan synchronizer and callbacks
+ */
+static volatile bool scan_done = false;
+static pthread_cond_t scan_cv = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t scan_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+void scan_callback(int32_t err, hb_scanner_t scanner,
+ hb_result_t results[], size_t num_results, void *extra) {
+ if (num_results) {
+ const char *table_name;
+ size_t table_name_len;
+ hb_result_get_table(results[0], &table_name, &table_name_len);
+ HBASE_LOG_INFO("Received scan_next callback for table=\'%.*s\', row count=%d.",
+ table_name_len, table_name, num_results);
+
+ for (int i = 0; i < num_results; ++i) {
+ printRow(results[i]);
+ hb_result_destroy(results[i]);
+ }
+ hb_scanner_next(scanner, scan_callback, NULL);
+ } else {
+ hb_scanner_destroy(scanner, NULL, NULL);
+ pthread_mutex_lock(&scan_mutex);
+ scan_done = true;
+ pthread_cond_signal(&scan_cv);
+ pthread_mutex_unlock(&scan_mutex);
+ }
+}
+
+static void
+wait_for_scan() {
+ HBASE_LOG_INFO("Waiting for scan to complete.");
+ pthread_mutex_lock(&scan_mutex);
+ while (!scan_done) {
+ pthread_cond_wait(&scan_cv, &scan_mutex);
+ }
+ pthread_mutex_unlock(&scan_mutex);
+ HBASE_LOG_INFO("Scan completed.");
+}
+
+/**
+ * Client destroy synchronizer and callbacks
+ */
+static volatile bool client_destroyed = false;
+static pthread_cond_t client_destroyed_cv = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t client_destroyed_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static void
+client_disconnection_callback(int32_t err,
+ hb_client_t client, void *extra) {
+ HBASE_LOG_INFO("Received client disconnection callback.");
+ pthread_mutex_lock(&client_destroyed_mutex);
+ client_destroyed = true;
+ pthread_cond_signal(&client_destroyed_cv);
+ pthread_mutex_unlock(&client_destroyed_mutex);
+}
+
+static void
+wait_client_disconnection() {
+ HBASE_LOG_INFO("Waiting for client to disconnect.");
+ pthread_mutex_lock(&client_destroyed_mutex);
+ while (!client_destroyed) {
+ pthread_cond_wait(&client_destroyed_cv, &client_destroyed_mutex);
+ }
+ pthread_mutex_unlock(&client_destroyed_mutex);
+ HBASE_LOG_INFO("Client disconnected.");
+}
+
+static int
+ensureTable(hb_connection_t connection, const char *table_name) {
+ int32_t retCode = 0;
+ hb_admin_t admin = NULL;
+
+ if ((retCode = hb_admin_create(connection, &admin)) != 0) {
+ HBASE_LOG_ERROR("Could not create HBase admin : errorCode = %d.", retCode);
+ goto cleanup;
+ }
+
+ if ((retCode = hb_admin_table_exists(admin, NULL, table_name)) == 0) {
+ HBASE_LOG_INFO("Table '%s' exists, deleting...", table_name);
+ if ((retCode = hb_admin_table_delete(admin, NULL, table_name)) != 0) {
+ HBASE_LOG_ERROR("Could not delete table %s[%d].", table_name, retCode);
+ goto cleanup;
+ }
+ } else if (retCode != ENOENT) {
+ HBASE_LOG_ERROR("Error while checking if the table exists: errorCode = %d.", retCode);
+ goto cleanup;
+ }
+
+ hb_coldesc_create(FAMILIES[0], 1, &HCD[0]);
+ hb_coldesc_set_maxversions(HCD[0], 2);
+ hb_coldesc_set_minversions(HCD[0], 1);
+ hb_coldesc_set_ttl(HCD[0], 2147480000);
+ hb_coldesc_set_inmemory(HCD[0], 1);
+
+ hb_coldesc_create(FAMILIES[1], 1, &HCD[1]);
+
+ HBASE_LOG_INFO("Creating table '%s'...", table_name);
+ if ((retCode = hb_admin_table_create(admin, NULL, table_name, HCD, 2)) == 0) {
+ HBASE_LOG_INFO("Table '%s' created, verifying if enabled.", table_name);
+ retCode = hb_admin_table_enabled(admin, NULL, table_name);
+ CHECK_API_ERROR(retCode,
+ "Table '%s' is %senabled, result %d.", table_name, retCode?"not ":"");
+ retCode = hb_admin_table_disable(admin, NULL, table_name);
+ CHECK_API_ERROR(retCode,
+ "Attempted to disable table '%s', result %d.", table_name);
+ retCode = hb_admin_table_disable(admin, NULL, table_name);
+ CHECK_API_ERROR(retCode,
+ "Attempted to disable table '%s' again, result %d.", table_name);
+ retCode = hb_admin_table_enable(admin, NULL, table_name);
+ CHECK_API_ERROR(retCode,
+ "Attempted to enable table '%s', result %d.", table_name);
+ retCode = hb_admin_table_enable(admin, NULL, table_name);
+ CHECK_API_ERROR(retCode,
+ "Attempted to enable table '%s' again, result %d.", table_name);
+ }
+ hb_coldesc_destroy(HCD[0]);
+ hb_coldesc_destroy(HCD[1]);
+
+cleanup:
+ if (admin) {
+ hb_admin_destroy(admin, NULL, NULL);
+ }
+ return retCode;
+}
+
+/**
+ * Program entry point
+ */
+int
+main(int argc, char **argv) {
+ int32_t retCode = 0;
+ FILE* logFile = NULL;
+ hb_connection_t connection = NULL;
+ hb_client_t client = NULL;
+ const char *rowkey_prefix = "row";
+ const char *value_prefix = "test value";
+ bytebuffer column_a = bytebuffer_strcpy("column-a");
+ bytebuffer column_b = bytebuffer_strcpy("column-b");
+
+ const char *table_name = (argc > 1) ? argv[1] : "TempTable";
+ const char *zk_ensemble = (argc > 2) ? argv[2] : "localhost:2181";
+ const char *zk_root_znode = (argc > 3) ? argv[3] : NULL;
+ const size_t table_name_len = strlen(table_name);
+
+ const int num_puts = 10;
+ hb_put_t put = NULL;
+
+ srand(time(NULL));
+ hb_log_set_level(HBASE_LOG_LEVEL_DEBUG); // defaults to INFO
+ const char *logFilePath = getenv("HBASE_LOG_FILE");
+ if (logFilePath != NULL) {
+ FILE* logFile = fopen(logFilePath, "a");
+ if (!logFile) {
+ retCode = errno;
+ fprintf(stderr, "Unable to open log file \"%s\"", logFilePath);
+ perror(NULL);
+ goto cleanup;
+ }
+ hb_log_set_stream(logFile); // defaults to stderr
+ }
+
+ if ((retCode = hb_connection_create(zk_ensemble,
+ zk_root_znode,
+ &connection)) != 0) {
+ HBASE_LOG_ERROR("Could not create HBase connection : errorCode = %d.", retCode);
+ goto cleanup;
+ }
+
+ if ((retCode = ensureTable(connection, table_name)) != 0) {
+ HBASE_LOG_ERROR("Failed to ensure table %s : errorCode = %d", table_name, retCode);
+ goto cleanup;
+ }
+
+ HBASE_LOG_INFO("Connecting to HBase cluster using Zookeeper ensemble '%s'.",
+ zk_ensemble);
+ if ((retCode = hb_client_create(connection, &client)) != 0) {
+ HBASE_LOG_ERROR("Could not connect to HBase cluster : errorCode = %d.", retCode);
+ goto cleanup;
+ }
+
+ // let's send a batch of 10 puts with single cell asynchronously
+ outstanding_puts_count += num_puts;
+ for (int i = 0; i < num_puts; ++i) {
+ row_data_t *row_data = (row_data_t *) calloc(1, sizeof(row_data_t));
+ row_data->key = bytebuffer_printf("%s%02d", rowkey_prefix, i);
+ hb_put_create(row_data->key->buffer, row_data->key->length, &put);
+ hb_mutation_set_table(put, table_name, table_name_len);
+ hb_mutation_set_durability(put, DURABILITY_SKIP_WAL);
+ hb_mutation_set_bufferable(put, false);
+
+ cell_data_t *cell_data = new_cell_data();
+ row_data->first_cell = cell_data;
+ cell_data->value = bytebuffer_printf("%s%02d", value_prefix, i);
+
+ hb_cell_t *cell = (hb_cell_t*) calloc(1, sizeof(hb_cell_t));
+ cell_data->hb_cell = cell;
+
+ cell->row = row_data->key->buffer;
+ cell->row_len = row_data->key->length;
+ cell->family = FAMILIES[rand() % 2];
+ cell->family_len = 1;
+ cell->qualifier = column_a->buffer;
+ cell->qualifier_len = column_a->length;
+ cell->value = cell_data->value->buffer;
+ cell->value_len = cell_data->value->length;
+ cell->ts = HBASE_LATEST_TIMESTAMP;
+
+ hb_put_add_cell(put, cell);
+ HBASE_LOG_INFO("Sending row with row key : '%.*s'.",
+ cell->row_len, cell->row);
+ hb_mutation_send(client, put, put_callback, row_data);
+ }
+ hb_client_flush(client, client_flush_callback, NULL);
+ wait_for_flush();
+
+ wait_for_puts(); // outside the loop, wait for 10 puts to complete
+
+ // now, let's put two cells in a single row
+ outstanding_puts_count++;
+ {
+ row_data_t *row_data = (row_data_t *) calloc(1, sizeof(row_data_t));
+ row_data->key = bytebuffer_printf("row_with_two_cells");
+ hb_put_create(row_data->key->buffer, row_data->key->length, &put);
+ hb_mutation_set_table(put, table_name, table_name_len);
+ hb_mutation_set_durability(put, DURABILITY_SYNC_WAL);
+
+ // first cell
+ cell_data_t *cell1_data = new_cell_data();
+ row_data->first_cell = cell1_data;
+ cell1_data->value = bytebuffer_printf("cell1_value_v1");
+
+ hb_cell_t *cell1 = (hb_cell_t*) calloc(1, sizeof(hb_cell_t));
+ cell1_data->hb_cell = cell1;
+
+ cell1->row = row_data->key->buffer;
+ cell1->row_len = row_data->key->length;
+ cell1->family = FAMILIES[0];
+ cell1->family_len = 1;
+ cell1->qualifier = column_a->buffer;
+ cell1->qualifier_len = column_a->length;
+ cell1->value = cell1_data->value->buffer;
+ cell1->value_len = cell1_data->value->length;
+ cell1->ts = 1391111111111L;
+ hb_put_add_cell(put, cell1);
+
+ // second cell
+ cell_data_t *cell2_data = new_cell_data();
+ cell1_data->next_cell = cell2_data;
+ cell2_data->value = bytebuffer_printf("cell2_value_v1");
+
+ hb_cell_t *cell2 = (hb_cell_t*) calloc(1, sizeof(hb_cell_t));
+ cell2_data->hb_cell = cell2;
+
+ cell2->row = row_data->key->buffer;
+ cell2->row_len = row_data->key->length;
+ cell2->family = FAMILIES[1];
+ cell2->family_len = 1;
+ cell2->qualifier = column_b->buffer;
+ cell2->qualifier_len = column_b->length;
+ cell2->value = cell2_data->value->buffer;
+ cell2->value_len = cell2_data->value->length;
+ cell2->ts = 1391111111111L;
+ hb_put_add_cell(put, cell2);
+
+ HBASE_LOG_INFO("Sending row with row key : '%.*s'.",
+ cell1->row_len, cell1->row);
+ hb_mutation_send(client, put, put_callback, row_data);
+ wait_for_puts();
+ }
+
+ // now, let's put second version in one column
+ outstanding_puts_count++;
+ {
+ row_data_t *row_data = (row_data_t *) calloc(1, sizeof(row_data_t));
+ row_data->key = bytebuffer_printf("row_with_two_cells");
+ hb_put_create(row_data->key->buffer, row_data->key->length, &put);
+ hb_mutation_set_table(put, table_name, table_name_len);
+ hb_mutation_set_durability(put, DURABILITY_SYNC_WAL);
+
+ // first cell
+ cell_data_t *cell1_data = new_cell_data();
+ row_data->first_cell = cell1_data;
+ cell1_data->value = bytebuffer_printf("cell1_value_v2");
+
+ hb_cell_t *cell1 = (hb_cell_t*) calloc(1, sizeof(hb_cell_t));
+ cell1_data->hb_cell = cell1;
+
+ cell1->row = row_data->key->buffer;
+ cell1->row_len = row_data->key->length;
+ cell1->family = FAMILIES[0];
+ cell1->family_len = 1;
+ cell1->qualifier = column_a->buffer;
+ cell1->qualifier_len = column_a->length;
+ cell1->value = cell1_data->value->buffer;
+ cell1->value_len = cell1_data->value->length;
+ cell1->ts = 1392222222222L;
+ hb_put_add_cell(put, cell1);
+
+ HBASE_LOG_INFO("Sending row with row key : '%.*s'.",
+ cell1->row_len, cell1->row);
+ hb_mutation_send(client, put, put_callback, row_data);
+ wait_for_puts();
+ }
+
+ // now, scan the entire table
+ {
+ hb_scanner_t scanner = NULL;
+ hb_scanner_create(client, &scanner);
+ hb_scanner_set_table(scanner, table_name, table_name_len);
+ hb_scanner_set_num_max_rows(scanner, 3); // maximum 3 rows at a time
+ hb_scanner_set_num_versions(scanner, 10); // up to 10 versions of the cell
+ hb_scanner_next(scanner, scan_callback, NULL); // dispatch the call
+ wait_for_scan();
+ }
+
+ // fetch a row with row-key="row_with_two_cells"
+ {
+ bytebuffer rowKey = bytebuffer_strcpy("row_with_two_cells");
+ hb_get_t get = NULL;
+ hb_get_create(rowKey->buffer, rowKey->length, &get);
+ hb_get_add_column(get, FAMILIES[0], 1, NULL, 0);
+ hb_get_add_column(get, FAMILIES[1], 1, NULL, 0);
+ hb_get_set_table(get, table_name, table_name_len);
+ hb_get_set_num_versions(get, 10); // up to ten versions of each column
+
+ get_done = false;
+ hb_get_send(client, get, get_callback, rowKey);
+ wait_for_get();
+ }
+
+ // delete a specific version of a column
+ {
+ bytebuffer rowKey = bytebuffer_strcpy("row_with_two_cells");
+ hb_delete_t del = NULL;
+ hb_delete_create(rowKey->buffer, rowKey->length, &del);
+ hb_delete_add_column(del, FAMILIES[0], 1,
+ column_a->buffer, column_a->length, 1391111111112L);
+ hb_mutation_set_table(del, table_name, table_name_len);
+
+ delete_done = false;
+ hb_mutation_send(client, del, delete_callback, rowKey);
+ wait_for_delete();
+ }
+
+ // fetch a row with row-key="row_with_two_cells"
+ {
+ bytebuffer rowKey = bytebuffer_strcpy("row_with_two_cells");
+ hb_get_t get = NULL;
+ hb_get_create(rowKey->buffer, rowKey->length, &get);
+ hb_get_add_column(get, FAMILIES[0], 1, NULL, 0);
+ hb_get_add_column(get, FAMILIES[1], 1, NULL, 0);
+ hb_get_set_table(get, table_name, table_name_len);
+ hb_get_set_num_versions(get, 10); // up to ten versions of each column
+
+ get_done = false;
+ hb_get_send(client, get, get_callback, rowKey);
+ wait_for_get();
+ }
+
+cleanup:
+ if (client) {
+ HBASE_LOG_INFO("Disconnecting client.");
+ hb_client_destroy(client, client_disconnection_callback, NULL);
+ wait_client_disconnection();
+ }
+
+ if (connection) {
+ hb_connection_destroy(connection);
+ }
+
+ if (column_a) {
+ bytebuffer_free(column_a); // do not need 'column' anymore
+ }
+ if (column_b) {
+ bytebuffer_free(column_b);
+ }
+
+ if (logFile) {
+ fclose(logFile);
+ }
+
+ pthread_cond_destroy(&puts_cv);
+ pthread_mutex_destroy(&puts_mutex);
+
+ pthread_cond_destroy(&get_cv);
+ pthread_mutex_destroy(&get_mutex);
+
+ pthread_cond_destroy(&del_cv);
+ pthread_mutex_destroy(&del_mutex);
+
+ pthread_cond_destroy(&client_destroyed_cv);
+ pthread_mutex_destroy(&client_destroyed_mutex);
+
+ return retCode;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/hbase-native-client/src/main/java/org/apache/hadoop/hbase/jni/CallbackHandlers.java b/hbase-native-client/src/main/java/org/apache/hadoop/hbase/jni/CallbackHandlers.java
new file mode 100644
index 000000000000..48e84cb910c6
--- /dev/null
+++ b/hbase-native-client/src/main/java/org/apache/hadoop/hbase/jni/CallbackHandlers.java
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.hadoop.hbase.jni;
+
+public class CallbackHandlers {
+
+ private static volatile boolean nativeLibLoaded = false;
+ static {
+ try {
+ synchronized (CallbackHandlers.class) {
+ System.loadLibrary("hbase");
+ nativeLibLoaded = true;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static boolean isNativeLibLoaded() {
+ return nativeLibLoaded;
+ }
+
+ public static native void mutationCallBack(Throwable t,
+ long callback, long client, long mutation, Object result, long extra);
+
+ public static native void getCallBack(Throwable t,
+ long callback, long client, long get, Object result, long extra);
+
+ public static native void clientFlushCallBack(Throwable t,
+ long callback, long client, long extra);
+
+ public static native void clientCloseCallBack(Throwable t,
+ long callback, long client, long extra);
+
+ public static native void scannerCloseCallBack(Throwable t,
+ long callback, long scanner, long extra);
+
+ public static native void scanNextCallBack(Throwable t,
+ long callback, long scanner, Object[] results, int numResults, long extra);
+}
diff --git a/hbase-native-client/src/main/java/org/apache/hadoop/hbase/jni/ClientProxy.java b/hbase-native-client/src/main/java/org/apache/hadoop/hbase/jni/ClientProxy.java
new file mode 100644
index 000000000000..d68604cc38a7
--- /dev/null
+++ b/hbase-native-client/src/main/java/org/apache/hadoop/hbase/jni/ClientProxy.java
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.hadoop.hbase.jni;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.apache.hadoop.conf.Configuration;
+import org.hbase.async.HBaseClient;
+import org.hbase.async.KeyValue;
+import org.hbase.async.Scanner;
+
+public class ClientProxy implements Closeable {
+ private final HBaseClient client_;
+
+ ClientProxy(final Configuration conf) {
+ final String zkQuorum = conf.get("hbase.zookeeper.ensemble");
+ final String baseZNode = conf.get("zookeeper.znode.parent");
+ this.client_ = new HBaseClient(zkQuorum, baseZNode);
+ }
+
+ Scanner newScanner(byte[] table) {
+ return client_.newScanner(table);
+ }
+
+ public void sendMutation(final MutationProxy mutationProxy,
+ final long callback, final long client,
+ final long mutation, final long extra) {
+ mutationProxy.send(client_,
+ new MutationCallbackHandler