Page MenuHomePhabricator

[services] Rust Integration - Backup - c++ - Multiple put clients
ClosedPublic

Authored by karol on Sep 2 2022, 3:52 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 11:34 PM
Unknown Object (File)
Sun, Nov 10, 6:57 AM
Unknown Object (File)
Sun, Oct 27, 8:14 PM
Unknown Object (File)
Sun, Oct 27, 8:14 PM
Unknown Object (File)
Sun, Oct 27, 8:14 PM
Unknown Object (File)
Sun, Oct 27, 8:10 PM
Unknown Object (File)
Sun, Oct 27, 6:09 PM
Unknown Object (File)
Oct 23 2024, 10:06 AM

Details

Summary

Depends on D5035

In order to be able to handle multiple connections at the same time, we have to store a collection of clients in the rust state instead of having just one.

Here, I'm making the c++ calls to rust for the put client valid.

Test Plan
cd services
yarn run-integration-tests backup

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested changes to this revision.Sep 5 2022, 8:05 AM

Can we avoid having to put an additional argument to every call? This is error-prone.

This revision now requires changes to proceed.Sep 5 2022, 8:05 AM
In D5036#147000, @tomek wrote:

Can we avoid having to put an additional argument to every call? This is error-prone.

I think so, I'm not sure if this is so much error-prone, why?

We have to specify what holder do we refer to. I don't know how else would we do that.

I think I meant "I don't think so" instead of "I think so", sorry.

tomek requested changes to this revision.Sep 7 2022, 6:15 AM
In D5036#147321, @karol wrote:
In D5036#147000, @tomek wrote:

Can we avoid having to put an additional argument to every call? This is error-prone.

I think so, I'm not sure if this is so much error-prone, why?

We have to specify what holder do we refer to. I don't know how else would we do that.

If all the functions share the same context, we can create a struct and make functions methods of this struct (described in D5036).

I'm not sure if this is so much error-prone, why?

In each function we need to remember to pass exactly the same string. The problem is that we accept any string as a type, so the only way to make sure we use the same value is by careful reading, which isn't maintainable. If the solution with struct is a hard one, we can consider keeping this approach, but maybe there are other ways of achieving that.

This revision now requires changes to proceed.Sep 7 2022, 6:15 AM

I see your point. I would go with a follow-up for this as it looks uncertain and it may be quite a lot of work/refactoring.

https://linear.app/comm/issue/ENG-1759/avoid-specifying-context-for-each-rust-function

tomek requested changes to this revision.Sep 9 2022, 4:38 AM
tomek added inline comments.
services/backup/src/Reactors/server/AddAttachmentsUtility.cpp
72 ↗(On Diff #16235)

Is a cstring a recommended type to handle strings when using cxx?

This revision now requires changes to proceed.Sep 9 2022, 4:38 AM
karol added inline comments.
services/backup/src/Reactors/server/AddAttachmentsUtility.cpp
72 ↗(On Diff #16235)

This is really similar to what you pointed out in D5035: we could use something smoother than const char* for passing strings and I agree. Let's discuss it there.

tomek added inline comments.
services/backup/src/Reactors/server/AddAttachmentsUtility.cpp
72 ↗(On Diff #16235)

It would be a lot more efficient if this diff was updated instead of creating a follow-up

This revision is now accepted and ready to land.Sep 13 2022, 10:50 AM
karol edited the summary of this revision. (Show Details)

rebase