Page MenuHomePhabricator

[tunnelbroker-client] Creating a Cargo project file
ClosedPublic

Authored by max on Jan 17 2023, 5:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 6, 1:31 PM
Unknown Object (File)
Mon, May 6, 1:31 PM
Unknown Object (File)
Mon, May 6, 1:31 PM
Unknown Object (File)
Mon, May 6, 1:31 PM
Unknown Object (File)
Mon, May 6, 1:29 PM
Unknown Object (File)
Mon, May 6, 12:40 PM
Unknown Object (File)
Apr 5 2024, 2:01 PM
Unknown Object (File)
Apr 5 2024, 1:55 PM
Subscribers

Details

Summary

This diff introduces the creation of the Cargo project file for the tunnelbroker-client shared library.
This library would be used as a Tunnelbroker client library based on Tonic in a keyserver using the NAPI-RS bridge and in the native later using the CXX bridge.

Following dependencies were added:

  • anyhow: Using for easy passing Rust Result;
  • tokio: Used for creating runtime for the Tokio in D6281;
  • tonic: gRPC client used in D6281 and beyond;
  • prost and tonic-build: Dependency for the protobuf compilation in D6279;
  • lazy_static: Used for the lazy tokio runtime initialization in D6281;
  • tracing: We are using the tracing crate for better logging in the tokio threads;
  • futures, futures_utils: Is used in the D6284 for easy use of Tonic streams.

Linear task: ENG-2728

Test Plan

To build the project patch to the D6281 and run nix develop --accept-flake-config -c bash -c "cargo test"

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: jon, bartek.
This revision is now accepted and ready to land.Jan 17 2023, 11:14 AM
This revision now requires review to proceed.Jan 25 2023, 4:57 AM
tomek added a reviewer: ashoat.
tomek added inline comments.
shared/tunnelbroker-client/Cargo.toml
1–4 ↗(On Diff #20992)

Should we specify the license?

8 ↗(On Diff #20992)

Everywhere else we specify 1.23

11 ↗(On Diff #20992)

It is a little better idea to use once_cell instead, e.g. backup service does that.

ashoat requested changes to this revision.Jan 26 2023, 7:09 AM

Requesting changes for @tomek's comments

This revision now requires changes to proceed.Jan 26 2023, 7:09 AM

Updating tokio version and license.

max added inline comments.
shared/tunnelbroker-client/Cargo.toml
1–4 ↗(On Diff #20992)

Should we specify the license?

I think we should. I've added BSD-3-Clause. Thanks.

8 ↗(On Diff #20992)

Everywhere else we specify 1.23

Fixed.

11 ↗(On Diff #20992)

It is a little better idea to use once_cell instead, e.g. backup service does that.

I'm not sure about the compatibility of the once_cell, I think we can change to the once_cell later.

I don't have any context on once_cell, but the other two things have been done

This revision is now accepted and ready to land.Jan 27 2023, 12:20 PM

once_cell is an alternative to lazy_static that has a few advantages:

  • Doesn't need to use a macro
  • is actively maintained (lazy static latest release is from 3 years ago)
  • there's an RFC to include it in Rust standard library
  • has a few more handy features (docs link)

once_cell is an alternative to lazy_static that has a few advantages:

  • Doesn't need to use a macro
  • is actively maintained (lazy static latest release is from 3 years ago)
  • there's an RFC to include it in Rust standard library
  • has a few more handy features (docs link)

Thanks @tomek @bartek ! I've created a follow-up task.