Skip to content
This repository was archived by the owner on Oct 23, 2022. It is now read-only.

Commit c2d65cf

Browse files
author
Joonas Koivunen
committed
fix: examples and tests
1 parent a8c8abf commit c2d65cf

File tree

5 files changed

+10
-19
lines changed

5 files changed

+10
-19
lines changed

examples/dag_creation.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
use futures::join;
2-
use ipfs::{make_ipld, Ipfs, IpfsPath, Types, UninitializedIpfs};
2+
use ipfs::{make_ipld, Ipfs, IpfsOptions, IpfsPath, TestTypes, UninitializedIpfs};
33
use tokio::task;
44

55
#[tokio::main]
66
async fn main() {
77
tracing_subscriber::fmt::init();
88

99
// Initialize the repo and start a daemon
10-
let (ipfs, fut): (Ipfs<Types>, _) = UninitializedIpfs::default().await.start().await.unwrap();
10+
let opts = IpfsOptions::inmemory_with_generated_keys();
11+
let (ipfs, fut): (Ipfs<TestTypes>, _) = UninitializedIpfs::new(opts).start().await.unwrap();
1112
task::spawn(fut);
1213

1314
// Create a DAG

examples/fetch_and_cat.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ async fn main() {
4848

4949
// UninitializedIpfs will handle starting up the repository and return the facade (ipfs::Ipfs)
5050
// and the background task (ipfs::IpfsFuture).
51-
let (ipfs, fut): (Ipfs<TestTypes>, _) = UninitializedIpfs::new(opts, None)
52-
.await
53-
.start()
54-
.await
55-
.unwrap();
51+
let (ipfs, fut): (Ipfs<TestTypes>, _) = UninitializedIpfs::new(opts).start().await.unwrap();
5652

5753
// The background task must be spawned to use anything other than the repository; most notably,
5854
// the libp2p.

http/src/v0.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,8 @@ mod tests {
192192
use ipfs::{IpfsOptions, UninitializedIpfs};
193193

194194
let options = IpfsOptions::inmemory_with_generated_keys();
195-
let (ipfs, _): (Ipfs<TestTypes>, _) = UninitializedIpfs::new(options, None)
196-
.await
197-
.start()
198-
.await
199-
.unwrap();
195+
let (ipfs, _): (Ipfs<TestTypes>, _) =
196+
UninitializedIpfs::new(options).start().await.unwrap();
200197

201198
let (shutdown_tx, _) = tokio::sync::mpsc::channel::<()>(1);
202199

http/src/v0/root_files/add.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,7 @@ mod tests {
410410

411411
async fn tokio_ipfs() -> ipfs::Ipfs<ipfs::TestTypes> {
412412
let options = ipfs::IpfsOptions::inmemory_with_generated_keys();
413-
let (ipfs, fut) = ipfs::UninitializedIpfs::new(options, None)
414-
.await
415-
.start()
416-
.await
417-
.unwrap();
413+
let (ipfs, fut) = ipfs::UninitializedIpfs::new(options).start().await.unwrap();
418414

419415
tokio::spawn(fut);
420416
ipfs

src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ pub struct IpfsOptions {
142142
/// Bound listening addresses; by default the node will not listen on any address.
143143
pub listening_addrs: Vec<Multiaddr>,
144144

145-
/// The span for tracing purposes.
146-
span: Option<Span>,
145+
/// The span for tracing purposes. All futures returned by `Ipfs`, background task actions and
146+
/// swarm actions are instrumented with this span or spans referring to this as their parent.
147+
pub span: Option<Span>,
147148
}
148149

149150
impl fmt::Debug for IpfsOptions {

0 commit comments

Comments
 (0)