2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #include "async/hbase_mutations.h"
24 #include "core/hbase_types.h"
25 #include "core/mutation.h"
27 #include "core/delete.h"
29 #include "async/hbase_result.h"
32 int32_t hb_put_create(hb_put_t
* put_ptr
) {
33 (*put_ptr
) = reinterpret_cast<hb_put_t
>(new Put());
37 int32_t hb_delete_create(hb_delete_t
* delete_ptr
) {
38 (*delete_ptr
) = reinterpret_cast<hb_delete_t
>(new Delete());
42 int32_t hb_increment_create(hb_increment_t
* increment_ptr
) {
46 int32_t hb_append_create(hb_append_t
* append_ptr
) {
50 int32_t hb_mutation_destroy(hb_mutation_t mutation
) {
54 HBASE_API
int32_t hb_mutation_set_namespace(hb_mutation_t mutation
,
55 char * name_space
, size_t name_space_length
) {
56 Mutation
* m
= reinterpret_cast<Mutation
*>(mutation
);
57 m
->set_namespace(name_space
, name_space_length
);
61 HBASE_API
int32_t hb_mutation_set_table(hb_mutation_t mutation
,
62 char * table
, size_t table_length
) {
63 Mutation
* m
= reinterpret_cast<Mutation
*>(mutation
);
64 m
->set_namespace(table
, table_length
);
68 int32_t hb_mutation_set_row(hb_mutation_t mutation
,
69 unsigned char * rk
, size_t row_length
) {
70 Mutation
* m
= reinterpret_cast<Mutation
*>(mutation
);
71 m
->set_row(rk
, row_length
);
75 int32_t hb_mutation_set_durability(hb_mutation_t mutation
,
76 hb_durability_type durability
) {
77 Mutation
* m
= reinterpret_cast<Mutation
*>(mutation
);
78 m
->set_durability(durability
);
82 int32_t hb_put_add_cell(hb_put_t put
, hb_cell_t
* cell
) {
86 int32_t hb_delete_add_col(hb_increment_t incr
,
87 unsigned char * family
, size_t family_length
,
88 unsigned char * qual
, size_t qual_length
) {
92 int32_t hb_increment_add_value(hb_increment_t incr
,
93 unsigned char * family
, size_t family_length
,
94 unsigned char * qual
, size_t qual_length
,
99 int32_t hb_append_add_cell(hb_append_t put
, hb_cell_t
* cell
) {
103 int32_t hb_mutation_send(hb_client_t client
,
104 hb_mutation_t mutation
, hb_mutation_cb cb
,
107 cb(0, client
, mutation
, NULL
, extra
);