All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
citrusleaf.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2008-2013 by Aerospike.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  *****************************************************************************/
22 #pragma once
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include <citrusleaf/cl_types.h>
29 #include <citrusleaf/cl_async.h>
30 #include <citrusleaf/cl_cluster.h>
31 #include <citrusleaf/cl_object.h>
32 #include <citrusleaf/cl_write.h>
33 #include <citrusleaf/cl_info.h>
34 #include <citrusleaf/cl_kv.h>
35 #include <citrusleaf/cl_lookup.h>
36 #include <citrusleaf/cl_object.h>
38 #include <citrusleaf/cl_scan.h>
39 #include <citrusleaf/cl_batch.h>
40 
41 /******************************************************************************
42  * FUNCTIONS
43  ******************************************************************************/
44 
45 /**
46  * All citrusleaf functions return an integer. This integer is 0 if the
47  * call has succeeded, and a negative number if it has failed.
48  * All returns of pointers and objects are done through the parameters.
49  * (When in C++, use & parameters for return, but we're not there yet)
50  *
51  * 'void' return functions are only used for functions that are syntactically
52  * unable to fail.
53  */
54 
55 #define INFO_TIMEOUT_MS 500
56 
57 /**
58  * Call this init function sometime early, create our mutexes and a few other things.
59  * We'd prefer if this is only called once
60  */
61 int citrusleaf_init(void);
62 
63 void citrusleaf_change_tend_speed(int secs);
64 
65 /**
66  * If you wish to free up resources used by the citrusleaf client in your process,
67  * call this - all cl_conn will be invalid, and you'll have to call citrusleaf_init
68  * again to do anything
69  */
70 void citrusleaf_shutdown(void);
71 
72 void citrusleaf_set_debug(bool debug_flag);
73 
74 /**
75  * This call will print stats to stderr
76  */
77 void citrusleaf_print_stats(void);
78 
80 typedef struct cl_cluster_compression_stat_s cl_cluster_compression_stat;
81 
82 extern void citrusleaf_cluster_put_compression_stat(cl_cluster *asc, uint64_t actual_sz, uint64_t compressed_sz);
83 extern void citrusleaf_cluster_get_compression_stat(cl_cluster *asc, uint64_t *actual_sz, uint64_t *compressed_sz);
84 
85 /*
86  * Set minimum size of packet, above which packet will be compressed before sending on wire,
87  * provided compression is enabled.
88  */
89 int
90 citrusleaf_cluster_change_compression_threshold(cl_cluster *asc, int size_in_bytes);
91 
92 /**
93  * This call is good for testing. Call it when you think you know the values. If the key doesn't exist, or
94  * the data is incorrect, then the server that is serving the request will spit a failure, and if you're
95  * running in the right server debug mode you can examine the error in detail.
96  */
97 cl_rv citrusleaf_verify(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, const cl_bin *bins, int n_bins, int timeout_ms, uint32_t *cl_gen);
98 cl_rv citrusleaf_delete_verify(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, const cl_write_parameters *cl_w_p);
99 
100 /**
101  * This call allows the caller to specify the operation - read, write, add, etc. Multiple operations
102  * can be specified in a single call.
103  */
104 
105 cl_rv citrusleaf_operate(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, bool check_key, cf_digest *d, cl_operation *operations, int n_operations, const cl_write_parameters *cl_w_p, uint32_t *generation, uint32_t* ttl);
106 cl_rv citrusleaf_operate_digest(cl_cluster *asc, const char *ns, const char *set, cf_digest *d, cl_operation *operations, int n_operations, const cl_write_parameters *cl_w_p, uint32_t *generation, uint32_t* ttl);
107 
108 /**
109  * This debugging call can be useful for tracking down errors and coordinating with server failures
110  * gets the digest for a particular set and key
111  */
112 int citrusleaf_calculate_digest(const char *set, const cl_object *key, cf_digest *digest);
113 
114 #ifdef __cplusplus
115 } // end extern "C"
116 #endif
117 
void citrusleaf_print_stats(void)
int citrusleaf_calculate_digest(const char *set, const cl_object *key, cf_digest *digest)
cl_rv citrusleaf_verify(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, const cl_bin *bins, int n_bins, int timeout_ms, uint32_t *cl_gen)
cl_rv
Definition: cl_types.h:64
uint32_t generation
void citrusleaf_cluster_get_compression_stat(cl_cluster *asc, uint64_t *actual_sz, uint64_t *compressed_sz)
void citrusleaf_shutdown(void)
void citrusleaf_set_debug(bool debug_flag)
cl_rv citrusleaf_delete_verify(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, const cl_write_parameters *cl_w_p)
cl_rv citrusleaf_operate(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, bool check_key, cf_digest *d, cl_operation *operations, int n_operations, const cl_write_parameters *cl_w_p, uint32_t *generation, uint32_t *ttl)
cl_rv citrusleaf_operate_digest(cl_cluster *asc, const char *ns, const char *set, cf_digest *d, cl_operation *operations, int n_operations, const cl_write_parameters *cl_w_p, uint32_t *generation, uint32_t *ttl)
void citrusleaf_change_tend_speed(int secs)
void citrusleaf_cluster_put_compression_stat(cl_cluster *asc, uint64_t actual_sz, uint64_t compressed_sz)
int citrusleaf_cluster_change_compression_threshold(cl_cluster *asc, int size_in_bytes)
int citrusleaf_init(void)