-
Notifications
You must be signed in to change notification settings - Fork 163
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
Extract node rpc #2927
base: main
Are you sure you want to change the base?
Extract node rpc #2927
Conversation
# Conflicts: # Cargo.lock # Cargo.toml # iroh-cli/Cargo.toml # iroh/Cargo.toml # iroh/src/client.rs # iroh/src/client/docs.rs # iroh/src/node/rpc.rs # iroh/src/rpc_protocol.rs
# Conflicts: # Cargo.lock # iroh/src/node/rpc.rs
and move the node and net proto, client and server there
# Conflicts: # Cargo.lock
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-14T11:19:25Z |
pub mod net; | ||
pub mod node; | ||
|
||
fn flatten<T, E1, E2>( |
There was a problem hiding this comment.
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 🤣
There was a problem hiding this comment.
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...
} | ||
|
||
/// Shuts down the node. | ||
/// | ||
/// If `force` is true, the node will be shut down instantly without | ||
/// waiting for things to stop gracefully. | ||
pub async fn shutdown(&self, force: bool) -> Result<()> { | ||
self.rpc.rpc(ShutdownRequest { force }).await?; | ||
Ok(()) | ||
self.node().shutdown(force).await |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should drop these helper methods, now that they are on .node()
chan: RpcChannel<RpcService, C>, | ||
) -> Result<(), RpcServerError<C>> { | ||
use net::Request::*; | ||
debug!("handling node request: {msg}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
net, not node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's confusing...
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 |
This would help with the insane amount of boilerplate you need when you want to write an iroh node for a specific set of protocols, like e.g. I have to do in the iroh-docs tests here: https://github.com/n0-computer/iroh-docs/blob/main/tests/util.rs#L36 Ideally it should be quite easy to write an iroh node for a specific set of protocols, complete with a bin and a cli that talks to the bin via rpc. |
Description
Breaking Changes
Notes & open questions
Change checklist