Page MenuHomePhabricator

[services] Tunnelbroker - Creating `main.rs` entry point file for Rust
ClosedPublic

Authored by max on Oct 20 2022, 7:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 2, 4:36 AM
Unknown Object (File)
Sun, Jun 30, 10:38 PM
Unknown Object (File)
Sat, Jun 29, 11:05 PM
Unknown Object (File)
Sat, Jun 29, 10:25 PM
Unknown Object (File)
Sat, Jun 29, 10:24 PM
Unknown Object (File)
Sat, Jun 29, 8:35 PM
Unknown Object (File)
Sat, Jun 29, 2:53 PM
Unknown Object (File)
Sat, Jun 29, 12:35 PM

Details

Summary

This diff is a part of the flat diffs stack to transform the current Tunnelbroker project into a Rust app by calling the current C++ codebase from Rust. The related transition task is ENG-1072.

This diff creates a Rust application entry point file main.rs and calls the initialization function (D5429) from the current C++ codebase.

Related Linear task: ENG-2092

CI Notice:
The CI will fail on this and further diffs until the D5461 where the changes to CI build commands are made.
This stack will be landed all in one to prevent CI from failing on diffs out of this stack.

Test Plan

1. CI Testing:
These diff changes are included as a part of the stack in the later D5461 diff, where the changes to CI build commands are made. The CI succeded on the D5461 which reflects that this changes are passing the build.

2. Manually testing:
These diff changes can be tested in the middle of the stack at D5436. To test it patch to D5436 using arc patch D5436, run nix develop. Go to tunnelbroker service directory services/tunnelbroker and run the Cargo building process cargo build or cargo run.
The Rust application will be successfully built.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

max held this revision as a draft.
max edited the test plan for this revision. (Show Details)
max added reviewers: varun, marcin. max added 1 blocking reviewer(s): jon.
max published this revision for review.Oct 20 2022, 8:22 AM
jon requested changes to this revision.Oct 21 2022, 9:26 AM
jon added inline comments.
services/tunnelbroker/src/main.rs
4 ↗(On Diff #17716)

I guess this is highly unrecommended: https://doc.rust-lang.org/std/macro.include.html

Leads to potential footguns around what is "defined" through it

This revision now requires changes to proceed.Oct 21 2022, 9:26 AM
max marked an inline comment as done.
max added inline comments.
services/tunnelbroker/src/main.rs
4 ↗(On Diff #17716)

I guess this is highly unrecommended: https://doc.rust-lang.org/std/macro.include.html

Leads to potential footguns around what is "defined" through it

We should include the C++ codebase exposed functions to the Rust app.
In a regular Rust app we shouldn't do this, but in our scenario, seems that this is the only way to include headers according to the cxx documentation.

max marked an inline comment as done.

Update on a stack reordering.

Update on the stack changes.

max edited the test plan for this revision. (Show Details)
max added 1 blocking reviewer(s): jon.

don't feel like blocking this work, since we have the goal of transitioning away from C++ eventually. So the issue of include! hygiene might not be relevant in the future.

This revision is now accepted and ready to land.Oct 26 2022, 1:51 PM
This revision now requires review to proceed.Oct 27 2022, 2:32 AM
This revision is now accepted and ready to land.Oct 27 2022, 4:37 AM
services/tunnelbroker/src/main.rs
10 ↗(On Diff #17864)

I would rather mane a function a a verb initialize

Rebasing on parent changes.

max added inline comments.
services/tunnelbroker/src/main.rs
10 ↗(On Diff #17864)

I would rather mane a function a a verb initialize

Looks ok to me to change it. Done in https://phab.comm.dev/D5429#164086.

max marked an inline comment as done.

Rebasing.

This revision was landed with ongoing or failed builds.Nov 7 2022, 6:02 AM
This revision was automatically updated to reflect the committed changes.