File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -44,15 +44,18 @@ async fn main() -> anyhow::Result<()> {
4444
4545 // create a protocol handler using an in-memory blob store.
4646 let store = MemStore::new();
47- let blobs = BlobsProtocol::new(&store, endpoint.clone(), None);
47+ let blobs = BlobsProtocol::new(&store, None);
4848
4949 // build the router
5050 let router = Router::builder(endpoint)
5151 .accept(iroh_blobs::ALPN, blobs.clone())
5252 .spawn();
5353
5454 let tag = blobs.add_slice(b"Hello world").await?;
55- println!("We are now serving {}", blobs.ticket(tag).await?);
55+ let _ = endpoint.online().await;
56+ let addr = endpoint.node_addr().initialized().await;
57+ let ticket = BlobTicket::new(addr, tag.hash, tag.format);
58+ println!("We are now serving {}", ticket);
5659
5760 // wait for control-c
5861 tokio::signal::ctrl_c().await;
Original file line number Diff line number Diff line change @@ -633,8 +633,7 @@ pub mod fsm {
633633 ///
634634 /// This is similar to [`bao_tree::io::DecodeError`], but takes into account
635635 /// that we are reading from a [`RecvStream`], so read errors will be
636- /// propagated as [`DecodeError::Read`], containing a [`ReadError`].
637- /// This carries more concrete information about the error than an [`io::Error`].
636+ /// propagated as [`DecodeError::Read`], containing a [`io::Error`].
638637 ///
639638 /// When the provider finds that it does not have a chunk that we requested,
640639 /// or that the chunk is invalid, it will stop sending data without producing
@@ -646,11 +645,6 @@ pub mod fsm {
646645 /// variants indicate that the provider has sent us invalid data. A well-behaved
647646 /// provider should never do this, so this is an indication that the provider is
648647 /// not behaving correctly.
649- ///
650- /// The [`DecodeError::DecodeIo`] variant is just a fallback for any other io error that
651- /// is not actually a [`DecodeError::Read`].
652- ///
653- /// [`ReadError`]: endpoint::ReadError
654648 #[ common_fields( {
655649 backtrace: Option <Backtrace >,
656650 #[ snafu( implicit) ]
Original file line number Diff line number Diff line change 1919//! let endpoint = Endpoint::builder().discovery_n0().bind().await?;
2020//!
2121//! // create a blobs protocol handler
22- //! let blobs = BlobsProtocol::new(&store, endpoint.clone(), None);
22+ //! let blobs = BlobsProtocol::new(&store, None);
2323//!
2424//! // create a router and add the blobs protocol handler
2525//! let router = Router::builder(endpoint)
2626//! .accept(iroh_blobs::ALPN, blobs.clone())
2727//! .spawn();
2828//!
29+ //! endpoint.online().await;
30+ //! let addr = endpoint.node_addr().initialized().await;
2931//! // this data is now globally available using the ticket
30- //! let ticket = blobs.ticket(t ).await?;
32+ //! let ticket = BlobTicket::new(addr, t.hash, t.format ).await?;
3133//! println!("ticket: {}", ticket);
3234//!
3335//! // wait for control-c to exit
You can’t perform that action at this time.
0 commit comments