Depends on D4945
This is the rest of the remaining functionalities for the put client to work. I realize that this diff is big and dirty but adding this as a draft, I may break this down in the future.
Differential D4946
[DRAFT] [services] Backup - Connect to Blob - Update put client Authored by • karol on Aug 24 2022, 12:57 PM.
Details Depends on D4945 This is the rest of the remaining functionalities for the put client to work. I realize that this diff is big and dirty but adding this as a draft, I may break this down in the future. Test code: #include <iostream>
#include <sstream>
#include "blob_client/src/lib.rs.h"
//...
try {
std::cout << "CALLING RUST CODE" << std::endl;
put_client_initialize_cxx();
put_client_write_cxx(0, "holder009");
put_client_blocking_read_cxx();
put_client_write_cxx(1, "hash005");
rust::String responseStr = put_client_blocking_read_cxx();
const char *value = responseStr.c_str();
unsigned int intValue;
std::stringstream strValue;
strValue << value;
strValue >> intValue;
bool dataExists = (bool)intValue;
std::cout << "response if the data exists: " << dataExists << std::endl;
if (dataExists) {
std::cout << "data exists, skipping sending chunks" << std::endl;
} else {
std::cout << "data doesn't exist, sending chunks" << std::endl;
put_client_write_cxx(2, "data CHUNK :):):)");
}
// rust::Vec<rust::String> errorMessages = put_client_terminate_cxx();
// std::cout << "terminated rust client, errors: " << errorMessages.size()
// << std::endl;
// for (auto it = errorMessages.begin(); it != errorMessages.end(); ++it) {
// std::cout << "=> " << it->c_str() << std::endl;
// }
put_client_terminate_cxx();
std::cout << "CALLED RUST CODE" << std::endl;
} catch (const std::exception &err) {
std::cout << "rust error: " << err.what() << std::endl;
}
Diff Detail
Event TimelineComment Actions This diff modifies the code that was introduced in the same stack and is not yet landed: e.g. it deletes transmitter_handle. If we don't need that, please update the diff that introduces it. I know it's a draft, but before having a final solution please split this diff so that each of them contains just one thing. This one introduces a couple of new concepts.
Comment Actions Abandoning this stack in favor of the new one that starts @ D5002. All the comments have been either addressed inline or in the new stack. Comment Actions Abandoning this stack in favor of the new one that starts @ D5002. All the comments have been either addressed inline or in the new stack. | |||||||||||||||||||||||||||||||||||||