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

refactor(iroh)!: Extract net and node rpc #2927

Merged
merged 42 commits into from
Nov 20, 2024
Merged

refactor(iroh)!: Extract net and node rpc #2927

merged 42 commits into from
Nov 20, 2024

Conversation

rklaehn
Copy link
Contributor

@rklaehn rklaehn commented Nov 14, 2024

Description

Introduce a new crate iroh-node-util.

This contains generic utilities that are needed to build an iroh node, as well as the rpc protocol and rpc client to remote control an arbitrary iroh-net endpoint (add/remove addresses etc.) as well as to control the node as a whole (shutdown/stats/status).

Breaking Changes

  • module iroh::client::net is now a reexport of iroh_node_util::rpc::client::net
  • module iroh::client::node is now a reexport of iroh_node_util::rpc::client::node
  • fn iroh::client::Iroh::net returns a net::Client instead of a &net::Client
  • fn iroh::client::Iroh::node returns a node::Client instead of a &node::Client

Notes & open questions

Note: I think the rpc protocol and the client needs some refactoring. It isn't always clear to me what is node and what is net. But I think it might be best to do this in a subsequent PR and keep this one as a pure move things around PR for better separation.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

Copy link

github-actions bot commented Nov 14, 2024

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2927/docs/iroh/

Last updated: 2024-11-20T10:37:17Z

pub mod net;
pub mod node;

fn flatten<T, E1, E2>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add this to quic-rpc? its used everywhere 🤣

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this used? In the context of streaming responses, right? I can maybe add it somewhere in client as an util...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super urgent, but I am adding it to quic-rpc: n0-computer/quic-rpc#120

iroh/src/client.rs Outdated Show resolved Hide resolved
@dignifiedquire
Copy link
Contributor

I like the structure, but I am not clear that we really need this in its own repo, or if we just leave it for the moment in iroh

@rklaehn rklaehn marked this pull request as ready for review November 19, 2024 15:44
Cargo.toml Outdated Show resolved Hide resolved
@rklaehn
Copy link
Contributor Author

rklaehn commented Nov 19, 2024

It's a very barebones crate for now. Not many deps and not a single feature...

This is the docs:
image

iroh/Cargo.toml Outdated Show resolved Hide resolved
@dignifiedquire
Copy link
Contributor

please document the breaking changes, otherwise I left some last comments and then this should be good to go

@dignifiedquire dignifiedquire added this to the v0.29.0 milestone Nov 20, 2024
@rklaehn rklaehn added this pull request to the merge queue Nov 20, 2024
Merged via the queue into main with commit f174c8e Nov 20, 2024
26 of 27 checks passed
@rklaehn rklaehn deleted the extract-node-rpc branch November 20, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants