33//! This is using an in memory database and a random node id.
44//! run this example from the project root:
55//! $ cargo run --example hello-world-provide
6- use std:: sync:: Arc ;
7-
86use iroh_base:: { node_addr:: AddrInfoOptions , ticket:: BlobTicket } ;
9- use iroh_blobs:: { downloader :: Downloader , net_protocol:: Blobs , util:: local_pool:: LocalPool } ;
7+ use iroh_blobs:: { net_protocol:: Blobs , util:: local_pool:: LocalPool } ;
108use tracing_subscriber:: { prelude:: * , EnvFilter } ;
119
1210// set the RUST_LOG env var to one of {debug,info,warn} to see logging info
@@ -26,21 +24,9 @@ async fn main() -> anyhow::Result<()> {
2624 // create a new node
2725 let mut builder = iroh:: node:: Node :: memory ( ) . build ( ) . await ?;
2826 let local_pool = LocalPool :: default ( ) ;
29- let store = iroh_blobs:: store:: mem:: Store :: new ( ) ;
30- let downloader = Downloader :: new (
31- store. clone ( ) ,
32- builder. endpoint ( ) . clone ( ) ,
33- local_pool. handle ( ) . clone ( ) ,
34- ) ;
35- let blobs = Arc :: new ( Blobs :: new_with_events (
36- store,
37- local_pool. handle ( ) . clone ( ) ,
38- Default :: default ( ) ,
39- downloader,
40- builder. endpoint ( ) . clone ( ) ,
41- ) ) ;
42- let blobs_client = blobs. clone ( ) . client ( ) ;
43- builder = builder. accept ( iroh_blobs:: protocol:: ALPN . to_vec ( ) , blobs) ;
27+ let blobs = Blobs :: memory ( ) . build ( local_pool. handle ( ) , builder. endpoint ( ) ) ;
28+ builder = builder. accept ( iroh_blobs:: ALPN . to_vec ( ) , blobs. clone ( ) ) ;
29+ let blobs_client = blobs. client ( ) ;
4430 let node = builder. spawn ( ) . await ?;
4531
4632 // add some data and remember the hash
0 commit comments