15 #ifdef _USE_AEROSPIKE_DB_
30 _clc = citrusleaf_cluster_create();
32 throw Poco::Exception(
"clc is not created");
38 citrusleaf_cluster_destroy(_clc);
45 std::string
host = url.getHost();
46 unsigned short port = url.getPort();
47 citrusleaf_cluster_add_host(_clc, host.c_str(),
port, TIMEOUT);
53 citrusleaf_object_init_str(&key_obj, key.c_str());
55 strcpy( value.bin_name,
docs[DEFAULT_DOCUMENT].c_str());
56 citrusleaf_object_init_str(&value.object, _value.c_str());
57 int return_value = citrusleaf_put(_clc, _dbName.c_str(), sets[DEFAULT_SET].c_str(), &key_obj, &value, 1, NULL);
58 if( return_value != CITRUSLEAF_OK ) {
59 std::cerr <<
"Failure setting values " << return_value <<
std::endl;
67 citrusleaf_object_init_str(&key_obj, key.c_str());
71 int rv = citrusleaf_get_all(_clc, _dbName.c_str(), sets[DEFAULT_SET].c_str(), &key_obj, &cl_v, &cl_v_len, TIMEOUT, &generation);
72 if (rv != CITRUSLEAF_OK) {
73 std::cerr <<
"get failed - " << rv <<
std::endl;
75 return std::string (
"");
78 for (
int i=0;i< cl_v_len;i++) {
80 fprintf(stderr,
"%d: bin %s ",i,cl_v[i].bin_name);
82 switch (cl_v[i].
object.type) {
85 fprintf(stderr,
"type string: value %s\n", cl_v[i].
object.u.str);
87 s = cl_v[i].object.u.str;
92 fprintf(stderr,
"type int: value %ld64\n",cl_v[i].
object.u.i64);
97 fprintf(stderr,
"type unknown! (%d)\n",(
int)cl_v[i].
object.type);
102 for (
int i = 0; i < cl_v_len; i++) {
103 citrusleaf_object_free(&cl_v[i].
object);
105 if (cl_v) free(cl_v);
110 std::vector<std::string>
data;
117 citrusleaf_object_init_str(&key_obj, key.c_str());
118 int return_value = citrusleaf_delete(_clc, _dbName.c_str(), sets[DEFAULT_SET].c_str(), &key_obj, NULL);
119 if( return_value != CITRUSLEAF_OK ) {