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 #ifndef ASYNC_HBASE_MUTATIONS_H_
21 #define ASYNC_HBASE_MUTATIONS_H_
27 #include "core/hbase_types.h"
28 #include "async/hbase_result.h"
34 * Ownership passes to the caller.
36 HBASE_API
int32_t hb_put_create(hb_put_t
* put_ptr
);
40 * Ownership passes to the caller.
42 HBASE_API
int32_t hb_delete_create(hb_delete_t
* delete_ptr
);
46 * Ownership passes to the caller.
48 HBASE_API
int32_t hb_increment_create(hb_increment_t
* increment_ptr
);
52 * Ownership passes to the caller.
54 HBASE_API
int32_t hb_append_create(hb_append_t
* append_ptr
);
57 * Destroy the mutation.
58 * All internal structures are cleaned up. However any backing
59 * data structures passed in by the user are not cleaned up.
61 HBASE_API
int32_t hb_mutation_destroy(hb_mutation_t mutation
);
64 HBASE_API
int32_t hb_mutation_set_namespace(hb_mutation_t mutation
,
65 char * name_space
, size_t name_space_length
);
66 HBASE_API
int32_t hb_mutation_set_table(hb_mutation_t mutation
,
67 char * table
, size_t table_length
);
68 HBASE_API
int32_t hb_mutation_set_row(hb_mutation_t mutation
,
69 unsigned char * rk
, size_t row_length
);
70 HBASE_API
int32_t hb_mutation_set_durability(hb_mutation_t mutation
,
71 hb_durability_type durability
);
74 HBASE_API
int32_t hb_put_add_cell(hb_put_t put
, hb_cell_t
* cell
);
77 HBASE_API
int32_t hb_delete_add_col(hb_increment_t incr
,
78 unsigned char * family
, size_t family_length
,
79 unsigned char * qual
, size_t qual_length
);
82 HBASE_API
int32_t hb_increment_add_value(hb_increment_t incr
,
83 unsigned char * family
, size_t family_length
,
84 unsigned char * qual
, size_t qual_length
,
88 HBASE_API
int32_t hb_append_add_cell(hb_append_t put
, hb_cell_t
* cell
);
90 // Now that the mutations are created and populated
91 // The real meat of the client is below.
94 * mutation call back typedef
96 typedef void (* hb_mutation_cb
)(int32_t status
,
97 hb_client_t client
, hb_mutation_t mutation
,
98 hb_result_t result
, void * extra
);
101 * Queue a single mutation. This mutation will be
102 * sent out in the background and can be batched with
103 * other requests destined for the same server.
105 * The call back will be executed after the response
106 * is received from the RegionServer. Even if the
107 * mutation was batched with other requests,
108 * the call back will be invoked for every mutation
111 HBASE_API
int32_t hb_mutation_send(hb_client_t client
,
112 hb_mutation_t mutation
, hb_mutation_cb cb
,
117 #endif // __cplusplus
119 #endif // ASYNC_HBASE_MUTATIONS_H_