Skip to content

Commit 5ba20cc

Browse files
author
“ramfox”
committed
use latest irpc, iroh-quinn, and iroh
1 parent 14daf11 commit 5ba20cc

File tree

17 files changed

+214
-249
lines changed

17 files changed

+214
-249
lines changed

Cargo.lock

Lines changed: 16 additions & 49 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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ bao-tree = { version = "0.15.1", features = ["experimental-mixed", "tokio_fsm",
99
bytes = { version = "1", features = ["serde"] }
1010
derive_more = { version = "2.0.1", features = ["from", "try_from", "into", "debug", "display", "deref", "deref_mut"] }
1111
futures-lite = "2.6.0"
12-
quinn = { package = "iroh-quinn", version = "0.13.0" }
12+
quinn = { package = "iroh-quinn", version = "0.14.0" }
1313
n0-future = "0.1.2"
1414
n0-snafu = "0.2.0"
1515
n0-watcher = "0.2.0"
16-
nested_enum_utils = "0.2.1"
1716
range-collections = { version = "0.4.6", features = ["serde"] }
1817
redb = "2.4.0"
1918
smallvec = { version = "1", features = ["serde", "const_new"] }
@@ -28,19 +27,20 @@ serde = "1.0.217"
2827
postcard = { version = "1.1.1", features = ["experimental-derive", "use-std"] }
2928
data-encoding = "2.8.0"
3029
chrono = "0.4.39"
31-
nested_enum_utils = "0.1.0"
30+
nested_enum_utils = "0.2.1"
3231
ref-cast = "1.0.24"
3332
arrayvec = "0.7.6"
3433
iroh = "0.35"
3534
self_cell = "1.1.0"
3635
genawaiter = { version = "0.99.1", features = ["futures03"] }
3736
iroh-base = "0.35"
3837
reflink-copy = "0.1.24"
39-
irpc = { version = "0.3.0", features = ["rpc", "quinn_endpoint_setup", "message_spans", "stream"], default-features = false }
40-
irpc-derive = { version = "0.3.0", default-features = false }
38+
irpc = { version = "0.4.0", features = ["rpc", "quinn_endpoint_setup", "message_spans", "stream"], default-features = false }
39+
irpc-derive = { version = "0.4.0", default-features = false }
4140
iroh-metrics = { version = "0.32.0" }
4241
hashlink = "0.10.0"
4342
futures-buffered = "0.2.11"
43+
thiserror = "2.0.12"
4444

4545
[dev-dependencies]
4646
clap = { version = "4.5.31", features = ["derive"] }
@@ -64,3 +64,5 @@ default = ["hide-proto-docs"]
6464
[patch.crates-io]
6565
iroh = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }
6666
iroh-base = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }
67+
irpc = { git = "https://github.com/n0-computer/irpc.git", branch = "iroh-quinn-latest" }
68+
irpc-derive = { git = "https://github.com/n0-computer/irpc.git", branch = "iroh-quinn-latest" }

src/api/blobs.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use bao_tree::{
2424
use bytes::Bytes;
2525
use genawaiter::sync::Gen;
2626
use iroh_io::{AsyncStreamReader, TokioStreamReader};
27-
use irpc::channel::{oneshot, spsc};
27+
use irpc::channel::{mpsc, oneshot};
2828
use n0_future::{Stream, StreamExt, future, stream};
2929
use quinn::SendStream;
3030
use range_collections::{RangeSet2, range_set::RangeSetRange};
@@ -225,7 +225,7 @@ impl Blobs {
225225
};
226226
let client = self.client.clone();
227227
let stream = Gen::new(|co| async move {
228-
let (mut sender, mut receiver) = match client.bidi_streaming(inner, 32, 32).await {
228+
let (sender, mut receiver) = match client.bidi_streaming(inner, 32, 32).await {
229229
Ok(x) => x,
230230
Err(cause) => {
231231
co.yield_(AddProgressItem::Error(cause.into())).await;
@@ -338,7 +338,7 @@ impl Blobs {
338338
trace!("{:?}", options);
339339
if options.hash == Hash::EMPTY {
340340
return ObserveProgress::new(async move {
341-
let (mut tx, rx) = spsc::channel(1);
341+
let (tx, rx) = mpsc::channel(1);
342342
tx.send(Bitfield::complete(0)).await.ok();
343343
Ok(rx)
344344
});
@@ -405,7 +405,7 @@ impl Blobs {
405405
let tree = BaoTree::new(size.get(), IROH_BLOCK_SIZE);
406406
let mut decoder = ResponseDecoder::new(hash.into(), ranges, tree, reader);
407407
let options = ImportBaoOptions { hash, size };
408-
let mut handle = self.import_bao_with_opts(options, 32).await?;
408+
let handle = self.import_bao_with_opts(options, 32).await?;
409409
let driver = async move {
410410
let reader = loop {
411411
match decoder.next().await {
@@ -509,7 +509,7 @@ impl<'a> BatchAddProgress<'a> {
509509
pub struct Batch<'a> {
510510
scope: Scope,
511511
blobs: &'a Blobs,
512-
_tx: spsc::Sender<BatchResponse>,
512+
_tx: mpsc::Sender<BatchResponse>,
513513
}
514514

515515
impl<'a> Batch<'a> {
@@ -647,7 +647,7 @@ impl<'a> AddProgress<'a> {
647647
/// Calling [`ObserveProgress::aggregated`] will return a stream of states,
648648
/// where each state is the current state at the time of the update.
649649
pub struct ObserveProgress {
650-
inner: future::Boxed<irpc::Result<spsc::Receiver<Bitfield>>>,
650+
inner: future::Boxed<irpc::Result<mpsc::Receiver<Bitfield>>>,
651651
}
652652

653653
impl IntoFuture for ObserveProgress {
@@ -668,7 +668,7 @@ impl IntoFuture for ObserveProgress {
668668

669669
impl ObserveProgress {
670670
fn new(
671-
fut: impl Future<Output = irpc::Result<spsc::Receiver<Bitfield>>> + Send + 'static,
671+
fut: impl Future<Output = irpc::Result<mpsc::Receiver<Bitfield>>> + Send + 'static,
672672
) -> Self {
673673
Self {
674674
inner: Box::pin(fut),
@@ -710,7 +710,7 @@ impl ObserveProgress {
710710
/// It also implements [`IntoFuture`], so you can await it to get the size of the
711711
/// exported blob.
712712
pub struct ExportProgress {
713-
inner: future::Boxed<irpc::Result<spsc::Receiver<ExportProgressItem>>>,
713+
inner: future::Boxed<irpc::Result<mpsc::Receiver<ExportProgressItem>>>,
714714
}
715715

716716
impl IntoFuture for ExportProgress {
@@ -725,7 +725,7 @@ impl IntoFuture for ExportProgress {
725725

726726
impl ExportProgress {
727727
fn new(
728-
fut: impl Future<Output = irpc::Result<spsc::Receiver<ExportProgressItem>>> + Send + 'static,
728+
fut: impl Future<Output = irpc::Result<mpsc::Receiver<ExportProgressItem>>> + Send + 'static,
729729
) -> Self {
730730
Self {
731731
inner: Box::pin(fut),
@@ -768,15 +768,15 @@ impl ExportProgress {
768768

769769
/// A handle for an ongoing bao import operation.
770770
pub struct ImportBaoHandle {
771-
pub tx: spsc::Sender<BaoContentItem>,
771+
pub tx: mpsc::Sender<BaoContentItem>,
772772
pub rx: oneshot::Receiver<super::Result<()>>,
773773
}
774774

775775
impl ImportBaoHandle {
776776
pub(crate) async fn new(
777777
fut: impl Future<
778778
Output = irpc::Result<(
779-
spsc::Sender<BaoContentItem>,
779+
mpsc::Sender<BaoContentItem>,
780780
oneshot::Receiver<super::Result<()>>,
781781
)>,
782782
> + Send
@@ -789,20 +789,20 @@ impl ImportBaoHandle {
789789

790790
/// A progress handle for a blobs list operation.
791791
pub struct BlobsListProgress {
792-
inner: future::Boxed<irpc::Result<spsc::Receiver<super::Result<Hash>>>>,
792+
inner: future::Boxed<irpc::Result<mpsc::Receiver<super::Result<Hash>>>>,
793793
}
794794

795795
impl BlobsListProgress {
796796
fn new(
797-
fut: impl Future<Output = irpc::Result<spsc::Receiver<super::Result<Hash>>>> + Send + 'static,
797+
fut: impl Future<Output = irpc::Result<mpsc::Receiver<super::Result<Hash>>>> + Send + 'static,
798798
) -> Self {
799799
Self {
800800
inner: Box::pin(fut),
801801
}
802802
}
803803

804804
pub async fn hashes(self) -> RequestResult<Vec<Hash>> {
805-
let mut rx: spsc::Receiver<Result<Hash, super::Error>> = self.inner.await?;
805+
let mut rx: mpsc::Receiver<Result<Hash, super::Error>> = self.inner.await?;
806806
let mut hashes = Vec::new();
807807
while let Some(item) = rx.recv().await? {
808808
hashes.push(item?);
@@ -829,13 +829,13 @@ impl BlobsListProgress {
829829
/// You can get access to the underlying stream using the [`ExportBaoResult::stream`] method.
830830
pub struct ExportRangesProgress {
831831
ranges: RangeSet2<u64>,
832-
inner: future::Boxed<irpc::Result<spsc::Receiver<ExportRangesItem>>>,
832+
inner: future::Boxed<irpc::Result<mpsc::Receiver<ExportRangesItem>>>,
833833
}
834834

835835
impl ExportRangesProgress {
836836
fn new(
837837
ranges: RangeSet2<u64>,
838-
fut: impl Future<Output = irpc::Result<spsc::Receiver<ExportRangesItem>>> + Send + 'static,
838+
fut: impl Future<Output = irpc::Result<mpsc::Receiver<ExportRangesItem>>> + Send + 'static,
839839
) -> Self {
840840
Self {
841841
ranges,
@@ -909,12 +909,12 @@ impl ExportRangesProgress {
909909
///
910910
/// You can get access to the underlying stream using the [`ExportBaoResult::stream`] method.
911911
pub struct ExportBaoProgress {
912-
inner: future::Boxed<irpc::Result<spsc::Receiver<EncodedItem>>>,
912+
inner: future::Boxed<irpc::Result<mpsc::Receiver<EncodedItem>>>,
913913
}
914914

915915
impl ExportBaoProgress {
916916
fn new(
917-
fut: impl Future<Output = irpc::Result<spsc::Receiver<EncodedItem>>> + Send + 'static,
917+
fut: impl Future<Output = irpc::Result<mpsc::Receiver<EncodedItem>>> + Send + 'static,
918918
) -> Self {
919919
Self {
920920
inner: Box::pin(fut),

0 commit comments

Comments
 (0)