From 1ef01ad4c072eae80a2d0ba31629a379a78a7836 Mon Sep 17 00:00:00 2001 From: Elliott Clark Date: Thu, 19 Nov 2015 16:28:11 -0800 Subject: [PATCH] HBASE-14852 Update build env Also includes HBASE-14858 Clean up so core is ready for development on a recent version of c++ --- hbase-native-client/.buckconfig | 2 + hbase-native-client/.gitignore | 23 +-- hbase-native-client/CMakeLists.txt | 157 --------------------- hbase-native-client/Dockerfile | 22 +++ hbase-native-client/README.md | 15 +- hbase-native-client/bin/build-all.sh | 41 ------ hbase-native-client/bin/build-thirdparty.sh | 64 --------- hbase-native-client/bin/download-thirdparty.sh | 70 --------- hbase-native-client/bin/hbase-client-env.sh | 47 ------ hbase-native-client/bin/start-docker.sh | 32 +++++ hbase-native-client/cmake_modules/FindGTest.cmake | 53 ------- hbase-native-client/cmake_modules/FindLibEv.cmake | 47 ------ hbase-native-client/core/BUCK | 50 +++++++ hbase-native-client/core/admin.cc | 20 +++ hbase-native-client/core/admin.h | 22 +++ hbase-native-client/core/client.cc | 38 +++++ hbase-native-client/core/client.h | 24 ++++ hbase-native-client/core/connection.cc | 20 +++ hbase-native-client/core/connection.h | 26 ++++ hbase-native-client/core/connection_attr.h | 24 ++++ hbase-native-client/core/delete.cc | 21 +++ hbase-native-client/core/delete.h | 27 ++++ hbase-native-client/core/get.cc | 20 +++ hbase-native-client/core/get.h | 23 +++ hbase-native-client/core/hbase_macros.h | 56 ++++++++ hbase-native-client/core/mutation.cc | 41 ++++++ hbase-native-client/core/mutation.h | 58 ++++++++ hbase-native-client/core/put.cc | 21 +++ hbase-native-client/core/put.h | 27 ++++ hbase-native-client/core/scanner.cc | 20 +++ hbase-native-client/core/scanner.h | 22 +++ hbase-native-client/rpc/CMakeLists.txt | 17 +++ hbase-native-client/src/async/CMakeLists.txt | 32 ----- hbase-native-client/src/async/get-test.cc | 59 -------- hbase-native-client/src/async/hbase_admin.cc | 57 -------- hbase-native-client/src/async/hbase_admin.h | 69 --------- hbase-native-client/src/async/hbase_client.cc | 47 ------ hbase-native-client/src/async/hbase_client.h | 60 -------- hbase-native-client/src/async/hbase_connection.cc | 37 ----- hbase-native-client/src/async/hbase_connection.h | 52 ------- hbase-native-client/src/async/hbase_errno.h | 23 --- hbase-native-client/src/async/hbase_get.cc | 61 -------- hbase-native-client/src/async/hbase_get.h | 73 ---------- hbase-native-client/src/async/hbase_mutations.cc | 111 --------------- hbase-native-client/src/async/hbase_mutations.h | 119 ---------------- hbase-native-client/src/async/hbase_result.cc | 37 ----- hbase-native-client/src/async/hbase_result.h | 44 ------ hbase-native-client/src/async/hbase_scanner.cc | 59 -------- hbase-native-client/src/async/hbase_scanner.h | 80 ----------- hbase-native-client/src/async/mutations-test.cc | 102 ------------- hbase-native-client/src/core/CMakeLists.txt | 31 ---- hbase-native-client/src/core/admin.cc | 20 --- hbase-native-client/src/core/admin.h | 25 ---- hbase-native-client/src/core/client.cc | 20 --- hbase-native-client/src/core/client.h | 25 ---- hbase-native-client/src/core/connection.cc | 22 --- hbase-native-client/src/core/connection.h | 26 ---- hbase-native-client/src/core/connection_attr.h | 30 ---- hbase-native-client/src/core/delete.cc | 22 --- hbase-native-client/src/core/delete.h | 29 ---- hbase-native-client/src/core/get.cc | 20 --- hbase-native-client/src/core/get.h | 26 ---- .../src/core/hbase_connection_attr.cc | 41 ------ .../src/core/hbase_connection_attr.h | 51 ------- hbase-native-client/src/core/hbase_macros.h | 60 -------- hbase-native-client/src/core/hbase_types.h | 83 ----------- hbase-native-client/src/core/mutation.cc | 42 ------ hbase-native-client/src/core/mutation.h | 48 ------- hbase-native-client/src/core/put.cc | 22 --- hbase-native-client/src/core/put.h | 29 ---- hbase-native-client/src/core/scanner.cc | 20 --- hbase-native-client/src/core/scanner.h | 25 ---- hbase-native-client/src/rpc/CMakeLists.txt | 17 --- hbase-native-client/src/sync/CMakeLists.txt | 24 ---- hbase-native-client/src/sync/hbase_admin.cc | 51 ------- hbase-native-client/src/sync/hbase_admin.h | 61 -------- hbase-native-client/src/sync/hbase_connection.cc | 37 ----- hbase-native-client/src/sync/hbase_connection.h | 52 ------- hbase-native-client/third-party/BUCK | 105 ++++++++++++++ pom.xml | 4 + 80 files changed, 758 insertions(+), 2582 deletions(-) create mode 100644 hbase-native-client/.buckconfig delete mode 100644 hbase-native-client/CMakeLists.txt create mode 100644 hbase-native-client/Dockerfile delete mode 100755 hbase-native-client/bin/build-all.sh delete mode 100755 hbase-native-client/bin/build-thirdparty.sh delete mode 100755 hbase-native-client/bin/download-thirdparty.sh delete mode 100644 hbase-native-client/bin/hbase-client-env.sh create mode 100755 hbase-native-client/bin/start-docker.sh delete mode 100644 hbase-native-client/cmake_modules/FindGTest.cmake delete mode 100644 hbase-native-client/cmake_modules/FindLibEv.cmake create mode 100644 hbase-native-client/core/BUCK create mode 100644 hbase-native-client/core/admin.cc create mode 100644 hbase-native-client/core/admin.h create mode 100644 hbase-native-client/core/client.cc create mode 100644 hbase-native-client/core/client.h create mode 100644 hbase-native-client/core/connection.cc create mode 100644 hbase-native-client/core/connection.h create mode 100644 hbase-native-client/core/connection_attr.h create mode 100644 hbase-native-client/core/delete.cc create mode 100644 hbase-native-client/core/delete.h create mode 100644 hbase-native-client/core/get.cc create mode 100644 hbase-native-client/core/get.h create mode 100644 hbase-native-client/core/hbase_macros.h create mode 100644 hbase-native-client/core/mutation.cc create mode 100644 hbase-native-client/core/mutation.h create mode 100644 hbase-native-client/core/put.cc create mode 100644 hbase-native-client/core/put.h create mode 100644 hbase-native-client/core/scanner.cc create mode 100644 hbase-native-client/core/scanner.h create mode 100644 hbase-native-client/rpc/CMakeLists.txt delete mode 100644 hbase-native-client/src/async/CMakeLists.txt delete mode 100644 hbase-native-client/src/async/get-test.cc delete mode 100644 hbase-native-client/src/async/hbase_admin.cc delete mode 100644 hbase-native-client/src/async/hbase_admin.h delete mode 100644 hbase-native-client/src/async/hbase_client.cc delete mode 100644 hbase-native-client/src/async/hbase_client.h delete mode 100644 hbase-native-client/src/async/hbase_connection.cc delete mode 100644 hbase-native-client/src/async/hbase_connection.h delete mode 100644 hbase-native-client/src/async/hbase_errno.h delete mode 100644 hbase-native-client/src/async/hbase_get.cc delete mode 100644 hbase-native-client/src/async/hbase_get.h delete mode 100644 hbase-native-client/src/async/hbase_mutations.cc delete mode 100644 hbase-native-client/src/async/hbase_mutations.h delete mode 100644 hbase-native-client/src/async/hbase_result.cc delete mode 100644 hbase-native-client/src/async/hbase_result.h delete mode 100644 hbase-native-client/src/async/hbase_scanner.cc delete mode 100644 hbase-native-client/src/async/hbase_scanner.h delete mode 100644 hbase-native-client/src/async/mutations-test.cc delete mode 100644 hbase-native-client/src/core/CMakeLists.txt delete mode 100644 hbase-native-client/src/core/admin.cc delete mode 100644 hbase-native-client/src/core/admin.h delete mode 100644 hbase-native-client/src/core/client.cc delete mode 100644 hbase-native-client/src/core/client.h delete mode 100644 hbase-native-client/src/core/connection.cc delete mode 100644 hbase-native-client/src/core/connection.h delete mode 100644 hbase-native-client/src/core/connection_attr.h delete mode 100644 hbase-native-client/src/core/delete.cc delete mode 100644 hbase-native-client/src/core/delete.h delete mode 100644 hbase-native-client/src/core/get.cc delete mode 100644 hbase-native-client/src/core/get.h delete mode 100644 hbase-native-client/src/core/hbase_connection_attr.cc delete mode 100644 hbase-native-client/src/core/hbase_connection_attr.h delete mode 100644 hbase-native-client/src/core/hbase_macros.h delete mode 100644 hbase-native-client/src/core/hbase_types.h delete mode 100644 hbase-native-client/src/core/mutation.cc delete mode 100644 hbase-native-client/src/core/mutation.h delete mode 100644 hbase-native-client/src/core/put.cc delete mode 100644 hbase-native-client/src/core/put.h delete mode 100644 hbase-native-client/src/core/scanner.cc delete mode 100644 hbase-native-client/src/core/scanner.h delete mode 100644 hbase-native-client/src/rpc/CMakeLists.txt delete mode 100644 hbase-native-client/src/sync/CMakeLists.txt delete mode 100644 hbase-native-client/src/sync/hbase_admin.cc delete mode 100644 hbase-native-client/src/sync/hbase_admin.h delete mode 100644 hbase-native-client/src/sync/hbase_connection.cc delete mode 100644 hbase-native-client/src/sync/hbase_connection.h create mode 100644 hbase-native-client/third-party/BUCK diff --git a/hbase-native-client/.buckconfig b/hbase-native-client/.buckconfig new file mode 100644 index 0000000..3227a2a --- /dev/null +++ b/hbase-native-client/.buckconfig @@ -0,0 +1,2 @@ +[cxx] + gtest_dep = //third-party/googletest/googletest:google-test diff --git a/hbase-native-client/.gitignore b/hbase-native-client/.gitignore index f14b3be..b172fe9 100644 --- a/hbase-native-client/.gitignore +++ b/hbase-native-client/.gitignore @@ -14,25 +14,12 @@ #python *.pyc -# CMake Generated Files -CMakeCache.txt -CMakeFiles -Makefile -cmake_install.CMakeCache -cmake_install.cmake -install_manifest.txt -CTestTestfile.cmake -build -Testing +# Buck +buck-out +.buckd +*.swp # Thirdparty dirs - -thirdparty/glog-* -thirdparty/gtest-* -thirdparty/gtest -thirdparty/protobuf-* -thirdparty/libevent-* -thirdparty/libev-* -thirdparty/installed +third-party/googletest* diff --git a/hbase-native-client/CMakeLists.txt b/hbase-native-client/CMakeLists.txt deleted file mode 100644 index 819f178..0000000 --- a/hbase-native-client/CMakeLists.txt +++ /dev/null @@ -1,157 +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. - -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/Dockerfile b/hbase-native-client/Dockerfile new file mode 100644 index 0000000..70e823b --- /dev/null +++ b/hbase-native-client/Dockerfile @@ -0,0 +1,22 @@ +## +# 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. + +FROM pjameson/buck-folly-watchman + +RUN apt-get install -y libprotobuf-dev protobuf-compiler clang-format-3.7 vim + +WORKDIR /usr/local/src/hbase/hbase-native-client diff --git a/hbase-native-client/README.md b/hbase-native-client/README.md index 0bb4d48..76df596 100644 --- a/hbase-native-client/README.md +++ b/hbase-native-client/README.md @@ -19,11 +19,10 @@ under the License. # hbase-native-client -Native client for HBase 0.96 +Native client for HBase -This is a C library that implements a -HBase client. It's thread safe and libEv -based. +This is a C/C++ library that implements a +HBase client. ## Design Philosphy @@ -51,3 +50,11 @@ the hbase_ prefix is assumed to be implementation private. All C apis and typedefs will be prefixed with hb_. All typedefs end with _t. + + +## Docker + +The build environment is docker. This should keep a consistent +build environment for everyone. Buck the build system works +best with mmap'd files. On OSX this means that vmwarefusion +works the best. However it should work with just the defaults. diff --git a/hbase-native-client/bin/build-all.sh b/hbase-native-client/bin/build-all.sh deleted file mode 100755 index a3e45de..0000000 --- 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 097c1a4..0000000 --- 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 db98aae..0000000 --- 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 96763da..0000000 --- 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/start-docker.sh b/hbase-native-client/bin/start-docker.sh new file mode 100755 index 0000000..1c9b02e --- /dev/null +++ b/hbase-native-client/bin/start-docker.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +## +# 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 + +eval "$(docker-machine env docker-vm)" +docker build -t hbase_native . + + +mkdir third-party || true +if [[ ! -d third-party/googletest ]]; then + git clone https://github.com/google/googletest.git third-party/googletest +fi + + +docker run -v ${PWD}/..:/usr/local/src/hbase -it hbase_native /bin/bash diff --git a/hbase-native-client/cmake_modules/FindGTest.cmake b/hbase-native-client/cmake_modules/FindGTest.cmake deleted file mode 100644 index 8d27876..0000000 --- a/hbase-native-client/cmake_modules/FindGTest.cmake +++ /dev/null @@ -1,53 +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. - -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 5fd3e86..0000000 --- a/hbase-native-client/cmake_modules/FindLibEv.cmake +++ /dev/null @@ -1,47 +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. - -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/core/BUCK b/hbase-native-client/core/BUCK new file mode 100644 index 0000000..a7eaa9e --- /dev/null +++ b/hbase-native-client/core/BUCK @@ -0,0 +1,50 @@ +## +# 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. + + +cxx_binary( + name = "core", + headers = [ + "admin.h", + "client.h", + "connection.h", + "connection_attr.h", + "delete.h", + "get.h", + "hbase_macros.h", + "mutation.h", + "put.h", + "scanner.h", + ], + srcs = [ + "admin.cc", + "client.cc", + "connection.cc", + "get.cc", + "mutation.cc", + "put.cc", + "delete.cc", + "scanner.cc", + ], + deps = [ + "//third-party:folly", + "//third-party:wangle", + ], + visibility = [ + 'PUBLIC', + ], +) diff --git a/hbase-native-client/core/admin.cc b/hbase-native-client/core/admin.cc new file mode 100644 index 0000000..897e6bf --- /dev/null +++ b/hbase-native-client/core/admin.cc @@ -0,0 +1,20 @@ +/* + * 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/core/admin.h b/hbase-native-client/core/admin.h new file mode 100644 index 0000000..775181c --- /dev/null +++ b/hbase-native-client/core/admin.h @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +class Admin {}; diff --git a/hbase-native-client/core/client.cc b/hbase-native-client/core/client.cc new file mode 100644 index 0000000..c5da65e --- /dev/null +++ b/hbase-native-client/core/client.cc @@ -0,0 +1,38 @@ +/* + * 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" + +#include +#include +#include +#include + +using namespace folly; + +int main(int argc, char* argv[]) { + google::ParseCommandLineFlags(&argc, &argv, true); + google::InitGoogleLogging(argv[0]); + + FB_LOG_EVERY_MS(INFO, 10000) << "Hello"; + for (long i = 0; i < 10000000; i++) { + FB_LOG_EVERY_MS(INFO, 1) << Random::rand32(); + } + return 0; +} diff --git a/hbase-native-client/core/client.h b/hbase-native-client/core/client.h new file mode 100644 index 0000000..921cecc --- /dev/null +++ b/hbase-native-client/core/client.h @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include + +class Client {}; diff --git a/hbase-native-client/core/connection.cc b/hbase-native-client/core/connection.cc new file mode 100644 index 0000000..e9a28eb --- /dev/null +++ b/hbase-native-client/core/connection.cc @@ -0,0 +1,20 @@ +/* + * 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/core/connection.h b/hbase-native-client/core/connection.h new file mode 100644 index 0000000..5c9d6b8 --- /dev/null +++ b/hbase-native-client/core/connection.h @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +class Connection { + char *zk_quorum; + +public: + void set_zk_quorum(char *zk_q); +}; diff --git a/hbase-native-client/core/connection_attr.h b/hbase-native-client/core/connection_attr.h new file mode 100644 index 0000000..a312005 --- /dev/null +++ b/hbase-native-client/core/connection_attr.h @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include "core/hbase_macros.h" + +class ConnectionAttr {}; diff --git a/hbase-native-client/core/delete.cc b/hbase-native-client/core/delete.cc new file mode 100644 index 0000000..57030be --- /dev/null +++ b/hbase-native-client/core/delete.cc @@ -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. + */ + +#include "core/delete.h" + +Delete::~Delete() {} diff --git a/hbase-native-client/core/delete.h b/hbase-native-client/core/delete.h new file mode 100644 index 0000000..34f6a6c --- /dev/null +++ b/hbase-native-client/core/delete.h @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include "core/mutation.h" + +class Delete : public Mutation { +public: + ~Delete(); +}; diff --git a/hbase-native-client/core/get.cc b/hbase-native-client/core/get.cc new file mode 100644 index 0000000..9e11332 --- /dev/null +++ b/hbase-native-client/core/get.cc @@ -0,0 +1,20 @@ +/* + * 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/core/get.h b/hbase-native-client/core/get.h new file mode 100644 index 0000000..d7f3366 --- /dev/null +++ b/hbase-native-client/core/get.h @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + +#pragma once + +class Get {}; diff --git a/hbase-native-client/core/hbase_macros.h b/hbase-native-client/core/hbase_macros.h new file mode 100644 index 0000000..48304f0 --- /dev/null +++ b/hbase-native-client/core/hbase_macros.h @@ -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. + * + */ + +#pragma once + +#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 diff --git a/hbase-native-client/core/mutation.cc b/hbase-native-client/core/mutation.cc new file mode 100644 index 0000000..52910d5 --- /dev/null +++ b/hbase-native-client/core/mutation.cc @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "core/mutation.h" + +void Mutation::set_namespace(char *name_space, size_t name_space_length) { + this->name_space = name_space; + this->name_space_length = name_space_length; +} + +void Mutation::set_table(char *table, size_t table_length) { + this->table = table; + this->table_length = table_length; +} + +void Mutation::set_row(unsigned char *row, size_t row_length) { + this->row = row; + this->row_length = row_length; +} + +void Mutation::set_durability(durability_type durability) { + this->durability = durability; +} + +Mutation::~Mutation() {} diff --git a/hbase-native-client/core/mutation.h b/hbase-native-client/core/mutation.h new file mode 100644 index 0000000..1880571 --- /dev/null +++ b/hbase-native-client/core/mutation.h @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include + +typedef enum { + DELETE_ONE_VERSION, + DELETE_MULTIPLE_VERSIONS, + DELETE_FAMILY, + DELETE_FAMILY_VERSION +} delete_type; + +typedef enum { + USE_DEFAULT, + SKIP_WAL, + ASYNC_WAL, + SYNC_WAL, + HSYNC_WAL +} durability_type; + +class Mutation { + char *name_space; + size_t name_space_length; + + char *table; + size_t table_length; + + unsigned char *row; + size_t row_length; + + 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(durability_type durability); + + virtual ~Mutation(); +}; diff --git a/hbase-native-client/core/put.cc b/hbase-native-client/core/put.cc new file mode 100644 index 0000000..806a478 --- /dev/null +++ b/hbase-native-client/core/put.cc @@ -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. + */ + +#include "core/put.h" + +Put::~Put() {} diff --git a/hbase-native-client/core/put.h b/hbase-native-client/core/put.h new file mode 100644 index 0000000..d34aa0d --- /dev/null +++ b/hbase-native-client/core/put.h @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include "core/mutation.h" + +class Put : public Mutation { +public: + ~Put(); +}; diff --git a/hbase-native-client/core/scanner.cc b/hbase-native-client/core/scanner.cc new file mode 100644 index 0000000..a10e444 --- /dev/null +++ b/hbase-native-client/core/scanner.cc @@ -0,0 +1,20 @@ +/* + * 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/core/scanner.h b/hbase-native-client/core/scanner.h new file mode 100644 index 0000000..180865a --- /dev/null +++ b/hbase-native-client/core/scanner.h @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +class Scanner {}; diff --git a/hbase-native-client/rpc/CMakeLists.txt b/hbase-native-client/rpc/CMakeLists.txt new file mode 100644 index 0000000..2456923 --- /dev/null +++ b/hbase-native-client/rpc/CMakeLists.txt @@ -0,0 +1,17 @@ +# 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. + diff --git a/hbase-native-client/src/async/CMakeLists.txt b/hbase-native-client/src/async/CMakeLists.txt deleted file mode 100644 index b2ed461..0000000 --- a/hbase-native-client/src/async/CMakeLists.txt +++ /dev/null @@ -1,32 +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. - -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 df94ce2..0000000 --- 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 17ff2a7..0000000 --- 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 f03a83f..0000000 --- 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.cc b/hbase-native-client/src/async/hbase_client.cc deleted file mode 100644 index 98e3dbf..0000000 --- a/hbase-native-client/src/async/hbase_client.cc +++ /dev/null @@ -1,47 +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_client.h" - -#include -#include -#include - -#include "core/client.h" -#include "async/hbase_connection.h" - -int32_t hb_client_create(hb_client_t* client_ptr, - hb_connection_t connection) { - (*client_ptr) = reinterpret_cast(new Client()); - if (client_ptr == NULL) - return -1; // TODO(eclark): setup the errno file. - return 0; -} - -int32_t hb_client_destroy(hb_client_t client, - hb_client_disconnection_cb cb, void * extra) { - if (client == NULL) - return -2; - if (cb) { - cb(0, client, extra); - } - free(client); - return 0; -} - 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 34c3d98..0000000 --- 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.cc b/hbase-native-client/src/async/hbase_connection.cc deleted file mode 100644 index 57fa4f5..0000000 --- a/hbase-native-client/src/async/hbase_connection.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_connection.h" - -#include "core/connection.h" -#include "core/hbase_types.h" - -extern "C" { -int32_t hb_connection_create(hb_connection_t * connection_ptr, - hb_connection_attr_t connection_attr) { - (*connection_ptr) = reinterpret_cast(new Connection()); - if ((*connection_ptr) == NULL) - return -1; - return 0; -} -int32_t hb_connection_destroy(hb_connection_t connection) { - free(connection); - return 0; -} -} // extern "C" 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 343f36c..0000000 --- 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 1698bbd..0000000 --- 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 32048d8..0000000 --- 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 7d91c08..0000000 --- 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 2456dc0..0000000 --- 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 4000390..0000000 --- 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 9351270..0000000 --- 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 eecbbb3..0000000 --- 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 5a8e555..0000000 --- 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 cd3f544..0000000 --- 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 be5898e..0000000 --- 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 49f93b9..0000000 --- a/hbase-native-client/src/core/CMakeLists.txt +++ /dev/null @@ -1,31 +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. - -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 897e6bf..0000000 --- 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 624c4ac..0000000 --- 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 91c235c..0000000 --- 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 68348a8..0000000 --- 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 099f31d..0000000 --- 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 463b7b5..0000000 --- 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 a7c229e..0000000 --- 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 695f5bf..0000000 --- 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 5740fd9..0000000 --- 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 9e11332..0000000 --- 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 3a9fd28..0000000 --- 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.cc b/hbase-native-client/src/core/hbase_connection_attr.cc deleted file mode 100644 index 61940e8..0000000 --- a/hbase-native-client/src/core/hbase_connection_attr.cc +++ /dev/null @@ -1,41 +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/hbase_connection_attr.h" - -#include "core/hbase_macros.h" -#include "core/hbase_types.h" -#include "core/connection_attr.h" - -extern "C" { -int32_t hb_connection_attr_create(hb_connection_attr_t * attr_ptr) { - (*attr_ptr) = new ConnectionAttr(); - return (attr_ptr == NULL)?-1:0; -} - -int32_t hb_connection_attr_set_zk_quorum(hb_connection_t connection, - char * zk_quorum) { - return 0; -} - -int32_t hb_connection_attr_set_zk_root(hb_connection_t connection, - char * zk_root) { - return 0; -} -} 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 c73c818..0000000 --- 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 71765c8..0000000 --- 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 8889b92..0000000 --- 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.cc b/hbase-native-client/src/core/mutation.cc deleted file mode 100644 index 4855076..0000000 --- a/hbase-native-client/src/core/mutation.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "core/mutation.h" - -void Mutation::set_namespace(char * name_space, size_t name_space_length) { - this->name_space = name_space; - this->name_space_length = name_space_length; -} - -void Mutation::set_table(char * table, size_t table_length) { - this->table = table; - this->table_length = table_length; -} - -void Mutation::set_row(unsigned char * row, size_t row_length) { - this->row = row; - this->row_length = row_length; -} - -void Mutation::set_durability(hb_durability_type durability) { - this->durability = durability; -} - -Mutation::~Mutation() { -} diff --git a/hbase-native-client/src/core/mutation.h b/hbase-native-client/src/core/mutation.h deleted file mode 100644 index e35d595..0000000 --- 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 8bedc8b..0000000 --- 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 7bca3e3..0000000 --- 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 a10e444..0000000 --- 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 257583b..0000000 --- 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/rpc/CMakeLists.txt b/hbase-native-client/src/rpc/CMakeLists.txt deleted file mode 100644 index 2456923..0000000 --- a/hbase-native-client/src/rpc/CMakeLists.txt +++ /dev/null @@ -1,17 +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. - diff --git a/hbase-native-client/src/sync/CMakeLists.txt b/hbase-native-client/src/sync/CMakeLists.txt deleted file mode 100644 index bfb7e6c..0000000 --- a/hbase-native-client/src/sync/CMakeLists.txt +++ /dev/null @@ -1,24 +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. - -set( SYNC_SRC - hbase_connection.cc - hbase_admin.cc -) - - -add_library(hsync OBJECT ${SYNC_SRC}) diff --git a/hbase-native-client/src/sync/hbase_admin.cc b/hbase-native-client/src/sync/hbase_admin.cc deleted file mode 100644 index d43c8ec..0000000 --- a/hbase-native-client/src/sync/hbase_admin.cc +++ /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. - * - */ - -#include "sync/hbase_admin.h" - -#include -#include - -#include "core/admin.h" - -int32_t hb_admin_create(hb_admin_t** admin_ptr) { - (*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) { - Admin * adm = reinterpret_cast(admin); - delete adm; - 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, - bool * exists) { - *exists = true; - return 0; -} diff --git a/hbase-native-client/src/sync/hbase_admin.h b/hbase-native-client/src/sync/hbase_admin.h deleted file mode 100644 index 860bfba..0000000 --- a/hbase-native-client/src/sync/hbase_admin.h +++ /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. - * - */ - -#ifndef SYNC_HBASE_ADMIN_H_ -#define SYNC_HBASE_ADMIN_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include "core/hbase_macros.h" -#include "core/hbase_types.h" -#include "sync/hbase_connection.h" - - -/** - * 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); - -/* - * 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, bool * exists); - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // SYNC_HBASE_ADMIN_H_ diff --git a/hbase-native-client/src/sync/hbase_connection.cc b/hbase-native-client/src/sync/hbase_connection.cc deleted file mode 100644 index df05376..0000000 --- a/hbase-native-client/src/sync/hbase_connection.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 "sync/hbase_connection.h" - -#include "core/connection.h" -#include "core/hbase_types.h" - -extern "C" { -int32_t hb_connection_create(hb_connection_t * connection_ptr, - hb_connection_attr_t connection_attr) { - (*connection_ptr) = reinterpret_cast(new Connection()); - if ((*connection_ptr) == NULL) - return -1; - return 0; -} -int32_t hb_connection_destroy(hb_connection_t connection) { - free(connection); - return 0; -} -} // extern "C" diff --git a/hbase-native-client/src/sync/hbase_connection.h b/hbase-native-client/src/sync/hbase_connection.h deleted file mode 100644 index af9284d..0000000 --- a/hbase-native-client/src/sync/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 SYNC_HBASE_CONNECTION_H_ -#define SYNC_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 // SYNC_HBASE_CONNECTION_H_ - diff --git a/hbase-native-client/third-party/BUCK b/hbase-native-client/third-party/BUCK new file mode 100644 index 0000000..89d2c93 --- /dev/null +++ b/hbase-native-client/third-party/BUCK @@ -0,0 +1,105 @@ +## +# 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. + +def add_system_libs(names = []): + rules = [] + for name in names: + prebuilt_cxx_library( + name = name, + lib_name = name, + lib_dir = "/usr/lib/x86_64-linux-gnu" + ) + rules.append(":" + name) + + return rules + +system_libs = [ + "double-conversion", + "glog", + "gflags", + "unwind", + "lzma", + "boost_regex", +] +tp_dep_rules = add_system_libs(system_libs) +prebuilt_cxx_library( + name = "folly", + lib_name = "folly", + lib_dir = "/usr/local/lib", + deps = tp_dep_rules, + exported_linker_flags = [ + "-pthread", + "-lstdc++", + ], + visibility = [ + 'PUBLIC', + ] +) +prebuilt_cxx_library( + name = "follybenchmark", + lib_name = "follybenchmark", + lib_dir = "/usr/local/lib", + deps = tp_dep_rules + [":folly"], + exported_linker_flags = [ + "-pthread", + "-lstdc++", + ], + visibility = [ + 'PUBLIC', + ] +) +prebuilt_cxx_library( + name = "wangle", + lib_name = "wangle", + lib_dir = "/usr/local/lib", + deps = tp_dep_rules + [":folly"], + exported_linker_flags = [ + "-pthread", + "-lstdc++", + ], + visibility = [ + 'PUBLIC', + ] +) +cxx_library( + name = 'google-test', + srcs = [ + 'googletest/googletest/src/gtest-all.cc', + 'googletest/googlemock/src/gmock-all.cc', + 'googletest/googlemock/src/gmock_main.cc', + ], + header_namespace = '', + exported_headers = subdir_glob([ + ('googletest/googletest/include', '**/*.h'), + ('googletest/googlemock/include', '**/*.h'), + ]), + headers = subdir_glob([ + ('googletest/googletest', 'src/*.h'), + ('googletest/googletest', 'src/*.cc'), + ('googletest/googlemock', 'src/*.h'), + ('googletest/googlemock', 'src/*.cc'), + ]), + exported_linker_flags = [ + "-pthread", + "-lstdc++", + ], + visibility = [ + 'PUBLIC', + ], + deps = [ + ] +) diff --git a/pom.xml b/pom.xml index 08a1bf0..313809e 100644 --- a/pom.xml +++ b/pom.xml @@ -798,6 +798,10 @@ **/CHANGES.txt **/generated/** **/gen-*/** + + **/buck-out/** + **/.buckd/** + hbase-native-client/third-party/** conf/regionservers **/*.avpr -- 2.6.3