Skip to content

refactor!: Port to irpc, remove quic-rpc and cli impl #67

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Frando
Copy link
Member

@Frando Frando commented May 6, 2025

Description

  • Removes the quic-rpc based RPC implementation
  • Removes the CLI code
  • Uses irpc for communication with the Gossip actor, enabling an identical API between local and RPC use
    • The main functions to interact with gossip are defined on a new struct GossipApi. A Gossip instance always derefs to GossipApi, but GossipApi can also be created by connecting over RPC. Via this construction, the local and remote APIs are guaranteed to be identical.
    • Gossip only has these additional functions, which don't make sense over RPC: handle_connection, shutdown, metrics, and listen (to expose via RPC).

Breaking Changes

  • GossipReceiver does no longer implement Sync. This should not be an issue, because all methods need &mut self anyways. If this does bother you, please open an issue so that we can discuss.
  • GossipSender is no longer Clone, and GossipSender::send needs &mut self. This is a result of moving to irpc, see this issue
  • the cli module has been removed without alternatives, feel free to copy-paste code into your own crate.
  • the rpc module has been removed. Use Gossip::listen and GossipApi::connect to use iroh-gossip over a RPC connection.
  • net::Error variants changed: RpcSend and RpcRecv were removed
  • Gossip::subscribe_with_stream has been removed. If you needed this, you'd need to build this with a task loop instead.
  • Gossip::subscribe, Gossip::subscribe_with_opts and Gossip::subscribe_and_join are now methods on GossipApi. Gossip derefs to GossipApi so this should need no changes.
  • GossipApi::subscribe (previously Gossip::subscribe) is now async

Notes & open questions

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 May 6, 2025

Simulation report
GossipAll-n100-r5 with 4 seeds
        RMR    LDH  missed  duration 
 mean  1.01  10.00    0.00     715ms 
  max  1.02  11.00    0.00     788ms 
  min  1.00   9.00    0.00     490ms 

GossipAll-n20-r30 with 4 seeds
        RMR   LDH  missed  duration 
 mean  1.38  5.03    0.00     394ms 
  max  1.46  7.00    0.00     443ms 
  min  1.12  3.00    0.00     232ms 

GossipMulti-n100-r30 with 4 seeds
        RMR    LDH  missed  duration 
 mean  0.34  10.17    0.00     298ms 
  max  1.50  14.00    0.00     409ms 
  min  0.07   5.00    0.00     147ms 

GossipMulti-n1000-r30 with 4 seeds
        RMR    LDH  missed  duration 
 mean  0.44  20.43    0.00     583ms 
  max  2.06  26.00    0.00     718ms 
  min  0.04  12.00    0.00     319ms 

GossipMulti-n20-r30 with 4 seeds
        RMR   LDH  missed  duration 
 mean  0.27  3.97    0.00     146ms 
  max  1.61  6.00    0.00     264ms 
  min  0.06  2.00    0.00      83ms 

GossipSingle-n100-r30 with 4 seeds
        RMR   LDH  missed  duration 
 mean  0.08  5.00    0.00     147ms 
  max  1.50  5.00    0.00     147ms 
  min  0.01  5.00    0.00     147ms 

GossipSingle-n1000-r30 with 4 seeds
        RMR    LDH  missed  duration 
 mean  0.07  12.00    0.00     319ms 
  max  2.06  12.00    0.00     319ms 
  min  0.00  12.00    0.00     319ms 

GossipSingle-n20-r30 with 4 seeds
        RMR   LDH  missed  duration 
 mean  0.14  3.00    0.00      83ms 
  max  1.44  3.00    0.00      83ms 
  min  0.06  3.00    0.00      83ms 

comparing GossipAll-n100-r5
               RMR          LDH       missed     duration 
 mean       +0.00%       +0.00%       +0.00%       +0.00% 
 max        +0.00%       +0.00%       +0.00%       +0.00% 
 min        +0.00%       +0.00%       +0.00%       +0.00% 
comparing GossipAll-n20-r30
               RMR          LDH       missed     duration 
 mean       +0.00%       +0.00%       +0.00%       +0.00% 
 max        +0.00%       +0.00%       +0.00%       +0.00% 
 min        +0.00%       +0.00%       +0.00%       +0.00% 
comparing GossipMulti-n100-r30
               RMR          LDH       missed     duration 
 mean       +0.00%       +0.00%       +0.00%       +0.00% 
 max        +0.00%       +0.00%       +0.00%       +0.00% 
 min        +0.00%       +0.00%       +0.00%       +0.00% 
comparing GossipMulti-n1000-r30
               RMR          LDH       missed     duration 
 mean       +0.00%       +0.00%       +0.00%       +0.00% 
 max        +0.00%       +0.00%       +0.00%       +0.00% 
 min        +0.00%       +0.00%       +0.00%       +0.00% 
comparing GossipMulti-n20-r30
               RMR          LDH       missed     duration 
 mean       +0.00%       +0.00%       +0.00%       +0.00% 
 max        +0.00%       +0.00%       +0.00%       +0.00% 
 min        +0.00%       +0.00%       +0.00%       +0.00% 
comparing GossipSingle-n100-r30
               RMR          LDH       missed     duration 
 mean       +0.00%       +0.00%       +0.00%       +0.00% 
 max        +0.00%       +0.00%       +0.00%       +0.00% 
 min        +0.00%       +0.00%       +0.00%       +0.00% 
comparing GossipSingle-n1000-r30
               RMR          LDH       missed     duration 
 mean       +0.00%       +0.00%       +0.00%       +0.00% 
 max        +0.00%       +0.00%       +0.00%       +0.00% 
 min        +0.00%       +0.00%       +0.00%       +0.00% 
comparing GossipSingle-n20-r30
               RMR          LDH       missed     duration 
 mean       +0.00%       +0.00%       +0.00%       +0.00% 
 max        +0.00%       +0.00%       +0.00%       +0.00% 
 min        +0.00%       +0.00%       +0.00%       +0.00% 

Last updated: 2025-06-02T11:55:54Z

@n0bot n0bot bot added this to iroh May 6, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh May 6, 2025
Copy link

github-actions bot commented May 6, 2025

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

Last updated: 2025-06-02T11:50:55Z

@Frando Frando force-pushed the Frando/irpc branch 3 times, most recently from e3d6a72 to 4a7decc Compare May 8, 2025 12:17
@Frando Frando force-pushed the proto-fixes branch 2 times, most recently from 413f3a8 to 6f2656f Compare May 15, 2025 09:41
@Frando Frando changed the base branch from proto-fixes to Frando/test-net-big May 15, 2025 10:22
@Frando Frando force-pushed the Frando/test-net-big branch from cfefa65 to a80bf1b Compare May 19, 2025 12:13
@Frando Frando force-pushed the Frando/test-net-big branch from a80bf1b to 51218d1 Compare May 19, 2025 12:28
@Frando Frando changed the base branch from Frando/test-net-big to main May 20, 2025 12:04
@Frando Frando changed the title wip: irpc refactor: port to irpc May 20, 2025
/// ALPN protocol name
pub const GOSSIP_ALPN: &[u8] = b"/iroh-gossip/0";
/// Default channel capacity for topic subscription channels (one per topic)
const TOPIC_EVENTS_DEFAULT_CAP: usize = 2048;
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to crate::net::handles

@Frando Frando changed the title refactor: port to irpc refactor: Port to irpc, remove quic-rpc and cli impl May 20, 2025
@Frando Frando marked this pull request as ready for review May 20, 2025 12:47
@Frando Frando mentioned this pull request Jun 2, 2025
4 tasks
Copy link
Contributor

@divagant-martian divagant-martian left a comment

Choose a reason for hiding this comment

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

looks cleaner. It's missing the breaking changes description required for users to know how to upgrade

@Frando
Copy link
Member Author

Frando commented Jun 6, 2025

While working on the breaking changes list, these two points popped up that might need some consideration:

  • GossipReceiver does no longer implement Sync. This should not be an issue, because all methods need &mut self anyways. If this does bother you, please open an issue so that we can discuss.
  • GossipSender is no longer Clone, and GossipSender::send needs &mut self. This is a result of moving to irpc, see this issue

@Frando Frando changed the title refactor: Port to irpc, remove quic-rpc and cli impl refactor!: Port to irpc, remove quic-rpc and cli impl Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants