398aa58877
Signed-off-by: ljedrz <ljedrz@gmail.com>
25 lines
752 B
Rust
25 lines
752 B
Rust
use futures::join;
|
|
use ipfs::{Ipfs, IpfsPath, TestTypes, UninitializedIpfs};
|
|
use std::str::FromStr;
|
|
use tokio::task;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
tracing_subscriber::fmt::init();
|
|
|
|
let path =
|
|
IpfsPath::from_str("/ipfs/zdpuB1caPcm4QNXeegatVfLQ839Lmprd5zosXGwRUBJHwj66X").unwrap();
|
|
|
|
let (ipfs, fut): (Ipfs<TestTypes>, _) =
|
|
UninitializedIpfs::default().await.start().await.unwrap();
|
|
task::spawn(fut);
|
|
|
|
let f1 = ipfs.get_dag(path.sub_path("0").unwrap());
|
|
let f2 = ipfs.get_dag(path.sub_path("1").unwrap());
|
|
let (res1, res2) = join!(f1, f2);
|
|
println!("Received block with contents: {:?}", res1.unwrap());
|
|
println!("Received block with contents: {:?}", res2.unwrap());
|
|
|
|
ipfs.exit_daemon().await;
|
|
}
|