Skip to content

Commit 3e46b59

Browse files
committed
update deps (irpc, iroh, iroh_blobs, iroh_gossip)
1 parent 01f21e4 commit 3e46b59

File tree

8 files changed

+192
-217
lines changed

8 files changed

+192
-217
lines changed

Cargo.lock

Lines changed: 164 additions & 153 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ derive_more = { version = "1.0.0", features = [
2121
"deref",
2222
"display",
2323
"from",
24+
"from_str",
2425
"try_into",
2526
"into",
2627
"as_ref",
@@ -30,12 +31,12 @@ futures-buffered = "0.2.4"
3031
futures-lite = "2.3.0"
3132
futures-util = { version = "0.3.25" }
3233
hex = "0.4"
33-
iroh = { version = "0.90" }
34-
iroh-base = { version = "0.90", features = ["ticket"] }
35-
iroh-blobs = { version = "0.90" }
36-
iroh-gossip = { version = "0.90", features = ["net"] }
34+
iroh = { version = "0.91" }
35+
iroh-base = { version = "0.91", features = ["ticket"] }
36+
iroh-blobs = { version = "0.93" }
37+
iroh-gossip = { version = "0.91", features = ["net"] }
3738
iroh-metrics = { version = "0.35", default-features = false }
38-
irpc = { version = "0.5.0" }
39+
irpc = { version = "0.7.0" }
3940
n0-future = "0.1.3"
4041
num_enum = "0.7"
4142
postcard = { version = "1", default-features = false, features = [
@@ -61,7 +62,7 @@ tracing = "0.1"
6162

6263
[dev-dependencies]
6364
data-encoding = "2.6.0"
64-
iroh = { version = "0.90", features = ["test-utils"] }
65+
iroh = { version = "0.91", features = ["test-utils"] }
6566
nested_enum_utils = "0.1.0"
6667
parking_lot = "0.12.3"
6768
proptest = "1.2.0"
@@ -94,6 +95,3 @@ missing_debug_implementations = "warn"
9495
# do. To enable for a crate set `#![cfg_attr(iroh_docsrs,
9596
# feature(doc_cfg))]` in the crate.
9697
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] }
97-
98-
[patch.crates-io]
99-
iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "Frando/gc-protect" }

examples/setup.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use iroh::{protocol::Router, Endpoint};
2-
use iroh_blobs::{net_protocol::Blobs, store::mem::MemStore, ALPN as BLOBS_ALPN};
2+
use iroh_blobs::{store::mem::MemStore, BlobsProtocol, ALPN as BLOBS_ALPN};
33
use iroh_docs::{protocol::Docs, ALPN as DOCS_ALPN};
44
use iroh_gossip::{net::Gossip, ALPN as GOSSIP_ALPN};
55

@@ -27,7 +27,10 @@ async fn main() -> anyhow::Result<()> {
2727

2828
// setup router
2929
let _router = builder
30-
.accept(BLOBS_ALPN, Blobs::new(&blobs, endpoint.clone(), None))
30+
.accept(
31+
BLOBS_ALPN,
32+
BlobsProtocol::new(&blobs, endpoint.clone(), None),
33+
)
3134
.accept(GOSSIP_ALPN, gossip)
3235
.accept(DOCS_ALPN, docs)
3336
.spawn();

src/api.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ use self::{
3232
protocol::{
3333
AddrInfoOptions, AuthorCreateRequest, AuthorDeleteRequest, AuthorExportRequest,
3434
AuthorGetDefaultRequest, AuthorImportRequest, AuthorListRequest, AuthorSetDefaultRequest,
35-
CloseRequest, CreateRequest, DelRequest, DocsMessage, DocsProtocol, DocsService,
36-
DropRequest, GetDownloadPolicyRequest, GetExactRequest, GetManyRequest,
37-
GetSyncPeersRequest, ImportRequest, LeaveRequest, ListRequest, OpenRequest,
38-
SetDownloadPolicyRequest, SetHashRequest, SetRequest, ShareMode, ShareRequest,
39-
StartSyncRequest, StatusRequest, SubscribeRequest,
35+
CloseRequest, CreateRequest, DelRequest, DocsProtocol, DropRequest,
36+
GetDownloadPolicyRequest, GetExactRequest, GetManyRequest, GetSyncPeersRequest,
37+
ImportRequest, LeaveRequest, ListRequest, OpenRequest, SetDownloadPolicyRequest,
38+
SetHashRequest, SetRequest, ShareMode, ShareRequest, StartSyncRequest, StatusRequest,
39+
SubscribeRequest,
4040
},
4141
};
4242
use crate::{
@@ -52,7 +52,7 @@ pub mod protocol;
5252
pub type RpcError = serde_error::Error;
5353
pub type RpcResult<T> = std::result::Result<T, RpcError>;
5454

55-
type Client = irpc::Client<DocsMessage, DocsProtocol, DocsService>;
55+
type Client = irpc::Client<DocsProtocol>;
5656

5757
/// API wrapper for the docs service
5858
#[derive(Debug, Clone)]
@@ -75,7 +75,10 @@ impl DocsApi {
7575

7676
/// Listen for incoming RPC connections
7777
pub fn listen(&self, endpoint: quinn::Endpoint) -> Result<AbortOnDropHandle<()>> {
78-
let local = self.inner.local().context("cannot listen on remote API")?;
78+
let local = self
79+
.inner
80+
.as_local()
81+
.context("cannot listen on remote API")?;
7982
let handler: Handler<DocsProtocol> = Arc::new(move |msg, _rx, tx| {
8083
let local = local.clone();
8184
Box::pin(match msg {

src/api/actor.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use super::{
1515
AuthorGetDefaultResponse, AuthorImportRequest, AuthorImportResponse, AuthorListRequest,
1616
AuthorListResponse, AuthorSetDefaultRequest, AuthorSetDefaultResponse, CloseRequest,
1717
CloseResponse, CreateRequest, CreateResponse, DelRequest, DelResponse, DocsMessage,
18-
DocsService, DropRequest, DropResponse, GetDownloadPolicyRequest,
18+
DocsProtocol, DropRequest, DropResponse, GetDownloadPolicyRequest,
1919
GetDownloadPolicyResponse, GetExactRequest, GetExactResponse, GetManyRequest,
2020
GetSyncPeersRequest, GetSyncPeersResponse, ImportRequest, ImportResponse, LeaveRequest,
2121
LeaveResponse, ListRequest, ListResponse, OpenRequest, OpenResponse,
@@ -38,7 +38,7 @@ impl RpcActor {
3838
let (tx, rx) = tokio_mpsc::channel(64);
3939
let actor = Self { recv: rx, engine };
4040
task::spawn(actor.run());
41-
let local = LocalSender::<DocsMessage, DocsService>::from(tx);
41+
let local = LocalSender::<DocsProtocol>::from(tx);
4242
DocsApi {
4343
inner: local.into(),
4444
}
@@ -390,12 +390,7 @@ impl RpcActor {
390390
mode,
391391
addr_options,
392392
} = req;
393-
let me = self
394-
.endpoint
395-
.node_addr()
396-
.initialized()
397-
.await
398-
.map_err(|e| RpcError::new(&e))?;
393+
let me = self.endpoint.node_addr().initialized().await;
399394
let me = addr_options.apply(&me);
400395

401396
let capability = match mode {

src/api/protocol.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use iroh::NodeAddr;
77
use iroh_blobs::{api::blobs::ExportMode, Hash};
88
use irpc::{
99
channel::{mpsc, oneshot},
10-
rpc_requests, Service,
10+
rpc_requests,
1111
};
1212
use serde::{Deserialize, Serialize};
1313

@@ -20,12 +20,6 @@ use crate::{
2020
SignedEntry,
2121
};
2222

23-
/// The RPC service type for the docs protocol.
24-
#[derive(Debug, Clone, Copy)]
25-
pub struct DocsService;
26-
27-
impl Service for DocsService {}
28-
2923
/// Progress during import operations
3024
#[derive(Debug, Clone, Serialize, Deserialize)]
3125
pub enum ImportProgress {
@@ -310,7 +304,7 @@ pub struct AuthorDeleteResponse;
310304

311305
// Use the macro to generate both the DocsProtocol and DocsMessage enums
312306
// plus implement Channels for each type
313-
#[rpc_requests(DocsService, message = DocsMessage)]
307+
#[rpc_requests(message = DocsMessage)]
314308
#[derive(Serialize, Deserialize, Debug)]
315309
pub enum DocsProtocol {
316310
#[rpc(tx = oneshot::Sender<RpcResult<OpenResponse>>)]

src/engine.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -159,35 +159,6 @@ impl Engine {
159159
})
160160
}
161161

162-
// TODO(Frando): We can't port iroh-docs to 0.90 without something like this.
163-
// /// Return a callback that can be added to blobs to protect the content of
164-
// /// all docs from garbage collection.
165-
// pub fn protect_cb(&self) -> ProtectCb {
166-
// let sync = self.sync.clone();
167-
// Box::new(move |live| {
168-
// let sync = sync.clone();
169-
// Box::pin(async move {
170-
// let doc_hashes = match sync.content_hashes().await {
171-
// Ok(hashes) => hashes,
172-
// Err(err) => {
173-
// tracing::warn!("Error getting doc hashes: {}", err);
174-
// return;
175-
// }
176-
// };
177-
// for hash in doc_hashes {
178-
// match hash {
179-
// Ok(hash) => {
180-
// live.insert(hash);
181-
// }
182-
// Err(err) => {
183-
// tracing::error!("Error getting doc hash: {}", err);
184-
// }
185-
// }
186-
// }
187-
// })
188-
// })
189-
// }
190-
191162
/// Get the blob store.
192163
pub fn blob_store(&self) -> &Store {
193164
&self.blob_store

tests/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl Builder {
112112
};
113113
router = router.accept(
114114
iroh_blobs::ALPN,
115-
iroh_blobs::net_protocol::Blobs::new(&blobs, endpoint.clone(), None),
115+
iroh_blobs::BlobsProtocol::new(&blobs, endpoint.clone(), None),
116116
);
117117
router = router.accept(iroh_docs::ALPN, docs.clone());
118118
router = router.accept(iroh_gossip::ALPN, gossip.clone());

0 commit comments

Comments
 (0)