Page MenuHomePhabricator

[DRAFT] [services] Backup - Connect to Blob - Update put client
AbandonedPublic

Authored by karol on Aug 24 2022, 5:57 AM.
Tags
None
Referenced Files
F3536017: D4946.diff
Wed, Dec 25, 5:20 PM
Unknown Object (File)
Sun, Dec 8, 3:14 PM
Unknown Object (File)
Wed, Dec 4, 8:24 PM
Unknown Object (File)
Wed, Dec 4, 7:06 PM
Unknown Object (File)
Nov 10 2024, 6:58 AM
Unknown Object (File)
Nov 7 2024, 7:16 AM
Unknown Object (File)
Oct 29 2024, 2:31 PM
Unknown Object (File)
Oct 27 2024, 8:11 PM

Details

Summary

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 Plan

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

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

karol retitled this revision from [services] Backup - Connect to Blob - Update put client to [DRAFT] [services] Backup - Connect to Blob - Update put client.Aug 24 2022, 6:05 AM
karol edited the summary of this revision. (Show Details)
karol edited the test plan for this revision. (Show Details)
karol added reviewers: varun, tomek.
tomek requested changes to this revision.Aug 29 2022, 5:12 AM

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.

services/backup/blob_client/Cargo.toml
15

The newest version is 0.3.3 but we agreed to provide just major and minor versions.

The license is MIT so it's safe.

services/backup/blob_client/src/constants.rs
2

Is it a temporary solution to use http?

services/backup/blob_client/src/put_client.rs
87–89

Can't we just assign it to the return value of block_on?

110

Is it going to stop the whole server? We definitely don't want that behavior.

158–163

Can we somehow avoid the hang here?

168–170

Is there an option to lock just once?

This revision now requires changes to proceed.Aug 29 2022, 5:12 AM
services/backup/blob_client/src/put_client.rs
158–163

I don't think so. We can always increase the capacity but I don't think that's a good idea. I think we should just use the client correctly.

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.

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.