Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first version of rama-unix #370

Open
GlenDC opened this issue Dec 29, 2024 · 6 comments
Open

first version of rama-unix #370

GlenDC opened this issue Dec 29, 2024 · 6 comments
Assignees
Labels
low prio Low priority item. mentor available A mentor is available to help you through the issue.
Milestone

Comments

@GlenDC
Copy link
Member

GlenDC commented Dec 29, 2024

For now it will just be there to support UNIX Domain Sockets as transport layer.

In future other unix-only features can be added there as well.

@GlenDC GlenDC added this to the v0.3 milestone Dec 29, 2024
@GlenDC GlenDC added low prio Low priority item. mentor available A mentor is available to help you through the issue. labels Dec 29, 2024
@GlenDC
Copy link
Member Author

GlenDC commented Jan 6, 2025

The goals of this issue is

  1. to add a first version of rama-unix a new crate
  2. integrate this into rama-http-backend

NOTE that this needs to be cfg-gated to only be activated on unix platforms, as it won't work on other platforms
There's no way to anounce in cargo.toml the supported platforms (see rust-lang/cargo#6179) so it will just be in the usage of it. E.g. that we expose it in lib.rs of rama as follows:

#[cfg(target_family = "unix")]
#[doc(inline)]
pub use ::rama_unix as unix;

1. rama-unix

rama-unix will be very similar to https://github.com/plabayo/rama/tree/main/rama-tcp except that it will work with https://docs.rs/tokio/latest/tokio/net/struct.UnixStream.html and https://docs.rs/tokio/latest/tokio/net/struct.UnixListener.html instead of TcpStream and TcpListener.

rama-unix will be a lot a lot simpler (for now), as it will be a very thin wrapper around the tokio stuff

2. integrate in rama-http-backend

For the http integration there is the client and the server side:

  1. for client the support should be there automatically if you provide a client connector on rama-unix, similar to the tcp one: https://github.com/plabayo/rama/blob/main/rama-tcp/src/client/service/connector.rs (but a lot simpler)
  2. for server support you can provide #[cfg(target_family = "unix")]-gated methods for the http server similar to the tcp ones, in
    pub async fn listen<S, Response, A>(self, addr: A, service: S) -> HttpServeResult
    (listen_uds and listen_uds_with_state)

With these two points implemented the final step would be to provide an example in /examples (https://github.com/plabayo/rama/tree/main/examples) that is also e2e tested with a unix-only test similar to the other example tests, as found in https://github.com/plabayo/rama/tree/main/tests/integration/examples/example_tests

@tobySolutions
Copy link

Hey there! I saw this issue from the This week in Rust newsletter and I would love to pick it up!

I'd love any assistance to be mentored to get this in! Thank you in advance! I'll read through it to get a deeper understanding of the issue.

@GlenDC
Copy link
Member Author

GlenDC commented Feb 1, 2025

Sure, all yours. If something is not clear or you have questions, remarks, etc... Do let me know. Open a PR whenever you want, even if early draft, in case you need feedback or help, etc... Welcome and take care!

@tobySolutions
Copy link

Sure, all yours. If something is not clear or you have questions, remarks, etc... Do let me know. Open a PR whenever you want, even if early draft, in case you need feedback or help, etc... Welcome and take care!

Thank you very much!!

@chibuike-19
Copy link

Would love to work with @tobySolutions on this issue @GlenDC , thanks!

@GlenDC
Copy link
Member Author

GlenDC commented Feb 15, 2025

If you want to tag together, all good for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low prio Low priority item. mentor available A mentor is available to help you through the issue.
Projects
None yet
Development

No branches or pull requests

3 participants