Page MenuHomePhabricator

Implement wrapper around C++ bindings for blob download process.
AbandonedPublicDraft

Authored by marcin on Sep 19 2022, 6:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 9, 4:40 PM
Unknown Object (File)
Sat, Nov 9, 7:40 AM
Unknown Object (File)
Tue, Nov 5, 6:09 AM
Unknown Object (File)
Oct 11 2024, 2:16 PM
Unknown Object (File)
Oct 10 2024, 2:24 PM
Unknown Object (File)
Oct 10 2024, 2:24 PM
Unknown Object (File)
Oct 10 2024, 2:24 PM
Unknown Object (File)
Oct 10 2024, 2:20 PM

Details

Summary

This differential implements wrapper around generated C++ bindings for blob download process so that caller does not need to instantiate objects from ::rust namespace

Test Plan
  1. Launch local instance of blob service.
  2. Place the following code somewhere in CommCoreModule:
std::string holder = "test.holder.v0";
std::string hash = "test.hash.v0";

auto data = {
    std::string(4000000, 'a'),
    std::string(4000000, 'b'),
    std::string(4000000, 'c'),
    std::string(4000000, 'd'),
    std::string(4000000, 'e'),
    std::string(4000000, 'f'),
    std::string(4000000, 'g'),
};

UploadBlobClient client;
client.startUploadBlocking(holder, hash); 
for (auto &chunk : data) {
    client.uploadChunkBlocking((std::uint8_t *)chunk.c_str(), chunk.length());
} 
client.completeUploadBlocking();
std::vector<std::vector<std::uint8_t>> buffer;
DownloadBlobClient downloadClient(holder);
while (true) {
    auto resp = downloadClient.pullChunkBlocking();
    if (std::get<0>(resp)) {
        break;
    }
    buffer.push_back(std::get<1>(resp));
}
int sum = 0;
for (auto &it : buffer) {
    sum += it.size();
}
Logger::log("Total data size: " + std::to_string(sum));

Check the logs to ensure that size of downloaded data is 28000000

Diff Detail

Repository
rCOMM Comm
Branch
marcin/eng-384-native-rust-lib
Lint
No Lint Coverage
Unit
No Test Coverage