You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ec...@apache.org on 2014/01/03 23:52:43 UTC

svn commit: r1555272 [2/2] - in /hbase/trunk/hbase-native-client: ./ bin/ cmake_modules/ src/ src/async/ src/core/ src/rpc/ src/sync/

Added: hbase/trunk/hbase-native-client/src/core/hbase_types.h
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/core/hbase_types.h?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/core/hbase_types.h (added)
+++ hbase/trunk/hbase-native-client/src/core/hbase_types.h Fri Jan  3 22:52:41 2014
@@ -0,0 +1,83 @@
+/*
+ * 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 <stdint.h>
+#include <stddef.h>
+
+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_

Added: hbase/trunk/hbase-native-client/src/core/mutation.cc
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/core/mutation.cc?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/core/mutation.cc (added)
+++ hbase/trunk/hbase-native-client/src/core/mutation.cc Fri Jan  3 22:52:41 2014
@@ -0,0 +1,42 @@
+/*
+ * 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() {
+}

Added: hbase/trunk/hbase-native-client/src/core/mutation.h
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/core/mutation.h?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/core/mutation.h (added)
+++ hbase/trunk/hbase-native-client/src/core/mutation.h Fri Jan  3 22:52:41 2014
@@ -0,0 +1,48 @@
+/*
+ * 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 <stdlib.h>
+
+#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_
+
+

Added: hbase/trunk/hbase-native-client/src/core/put.cc
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/core/put.cc?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/core/put.cc (added)
+++ hbase/trunk/hbase-native-client/src/core/put.cc Fri Jan  3 22:52:41 2014
@@ -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.
+ */
+
+#include "core/put.h"
+
+Put::~Put() {
+}

Added: hbase/trunk/hbase-native-client/src/core/put.h
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/core/put.h?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/core/put.h (added)
+++ hbase/trunk/hbase-native-client/src/core/put.h Fri Jan  3 22:52:41 2014
@@ -0,0 +1,29 @@
+/*
+ * 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_

Added: hbase/trunk/hbase-native-client/src/core/scanner.cc
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/core/scanner.cc?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/core/scanner.cc (added)
+++ hbase/trunk/hbase-native-client/src/core/scanner.cc Fri Jan  3 22:52:41 2014
@@ -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"

Added: hbase/trunk/hbase-native-client/src/core/scanner.h
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/core/scanner.h?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/core/scanner.h (added)
+++ hbase/trunk/hbase-native-client/src/core/scanner.h Fri Jan  3 22:52:41 2014
@@ -0,0 +1,25 @@
+/*
+ * 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_

Added: hbase/trunk/hbase-native-client/src/rpc/CMakeLists.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/rpc/CMakeLists.txt?rev=1555272&view=auto
==============================================================================
    (empty)

Added: hbase/trunk/hbase-native-client/src/sync/CMakeLists.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/sync/CMakeLists.txt?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/sync/CMakeLists.txt (added)
+++ hbase/trunk/hbase-native-client/src/sync/CMakeLists.txt Fri Jan  3 22:52:41 2014
@@ -0,0 +1,19 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set( SYNC_SRC
+  hbase_connection.cc
+  hbase_admin.cc
+)
+
+
+add_library(hsync OBJECT ${SYNC_SRC})

Added: hbase/trunk/hbase-native-client/src/sync/hbase_admin.cc
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/sync/hbase_admin.cc?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/sync/hbase_admin.cc (added)
+++ hbase/trunk/hbase-native-client/src/sync/hbase_admin.cc Fri Jan  3 22:52:41 2014
@@ -0,0 +1,51 @@
+/*
+ * 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 <stdlib.h>
+#include <stdbool.h>
+
+#include "core/admin.h"
+
+int32_t hb_admin_create(hb_admin_t** admin_ptr) {
+  (*admin_ptr) = reinterpret_cast<hb_admin_t *>(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 *>(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;
+}

Added: hbase/trunk/hbase-native-client/src/sync/hbase_admin.h
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/sync/hbase_admin.h?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/sync/hbase_admin.h (added)
+++ hbase/trunk/hbase-native-client/src/sync/hbase_admin.h Fri Jan  3 22:52:41 2014
@@ -0,0 +1,61 @@
+/*
+ * 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 <stdlib.h>
+#include <stdbool.h>
+
+#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_

Added: hbase/trunk/hbase-native-client/src/sync/hbase_connection.cc
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/sync/hbase_connection.cc?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/sync/hbase_connection.cc (added)
+++ hbase/trunk/hbase-native-client/src/sync/hbase_connection.cc Fri Jan  3 22:52:41 2014
@@ -0,0 +1,37 @@
+/*
+ * 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<hb_connection_t>(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"

Added: hbase/trunk/hbase-native-client/src/sync/hbase_connection.h
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-native-client/src/sync/hbase_connection.h?rev=1555272&view=auto
==============================================================================
--- hbase/trunk/hbase-native-client/src/sync/hbase_connection.h (added)
+++ hbase/trunk/hbase-native-client/src/sync/hbase_connection.h Fri Jan  3 22:52:41 2014
@@ -0,0 +1,52 @@
+/*
+ * 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 <stdlib.h>
+
+/**
+ * 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_
+