Skip to content

Commit

Permalink
refactor(iroh): move ProtocolHandler impl to iroh-gossip (#2849)
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire authored Oct 28, 2024
1 parent bfba7a4 commit 6c6827d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ iroh-test = { path = "./iroh-test" }
iroh-router = { path = "./iroh-router" }

iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "main" }
iroh-gossip = { git = "https://github.com/n0-computer/iroh-gossip", branch = "main" }
1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ ignore = [
[sources]
allow-git = [
"https://github.com/n0-computer/iroh-blobs.git",
"https://github.com/n0-computer/iroh-gossip.git",
]
7 changes: 2 additions & 5 deletions iroh/src/node/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ use tokio::task::JoinError;
use tokio_util::{sync::CancellationToken, task::AbortOnDropHandle};
use tracing::{debug, error_span, trace, Instrument};

use super::{
protocol::gossip::GossipProtocol, rpc_status::RpcStatus, IrohServerEndpoint, JoinErrToStr,
Node, NodeInner,
};
use super::{rpc_status::RpcStatus, IrohServerEndpoint, JoinErrToStr, Node, NodeInner};
use crate::{
client::RPC_ALPN,
node::{
Expand Down Expand Up @@ -826,7 +823,7 @@ impl<D: iroh_blobs::store::Store> ProtocolBuilder<D> {
self = self.accept(iroh_blobs::protocol::ALPN.to_vec(), Arc::new(blobs_proto));

// Register gossip.
self = self.accept(GOSSIP_ALPN.to_vec(), Arc::new(GossipProtocol(gossip)));
self = self.accept(GOSSIP_ALPN.to_vec(), Arc::new(gossip));

// Register docs, if enabled.
if let Some(docs) = docs {
Expand Down
1 change: 0 additions & 1 deletion iroh/src/node/protocol.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub(crate) mod blobs;
pub(crate) mod docs;
pub(crate) mod gossip;
24 changes: 0 additions & 24 deletions iroh/src/node/protocol/gossip.rs

This file was deleted.

6 changes: 3 additions & 3 deletions iroh/src/node/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use iroh_blobs::{
BlobFormat, HashAndFormat, Tag,
};
use iroh_docs::net::DOCS_ALPN;
use iroh_gossip::net::GOSSIP_ALPN;
use iroh_gossip::net::{Gossip, GOSSIP_ALPN};
use iroh_io::AsyncSliceReader;
use iroh_net::{relay::RelayUrl, NodeAddr, NodeId};
use iroh_router::Router;
Expand All @@ -44,7 +44,7 @@ use crate::{
NodeStatus,
},
node::{
protocol::{blobs::BlobsProtocol, docs::DocsProtocol, gossip::GossipProtocol},
protocol::{blobs::BlobsProtocol, docs::DocsProtocol},
NodeInner,
},
rpc_protocol::{
Expand Down Expand Up @@ -257,7 +257,7 @@ impl<D: BaoStore> Handler<D> {
chan.bidi_streaming(msg, self, |handler, req, updates| {
let stream = handler
.router
.get_protocol::<GossipProtocol>(GOSSIP_ALPN)
.get_protocol::<Gossip>(GOSSIP_ALPN)
.expect("missing gossip")
.join_with_stream(
req.topic,
Expand Down

0 comments on commit 6c6827d

Please sign in to comment.