diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-12-08 18:55:12 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-12-08 18:55:12 +0100 |
commit | cd93da65aa447d3bf4ec53fbad040e77305b38c3 (patch) | |
tree | 692547f221e2b4a669fb0a7e04f74126c024a935 | |
parent | 7e94eaca8e0b11b0d982a480854177503c153a54 (diff) | |
parent | 3b69148977bcc3b5b3cb57882b75a407a381b00f (diff) |
Merge branch 'pin-everything'
-rw-r--r-- | src/client.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs index bb280a5..da8ad94 100644 --- a/src/client.rs +++ b/src/client.rs @@ -79,7 +79,13 @@ impl Client { } async fn post<S: Into<ipfs::Ipld>>(&self, s: S) -> Result<Cid> { - self.ipfs.put_dag(s.into()).await.map_err(anyhow::Error::from) + let cid = self.ipfs.put_dag(s.into()).await?; + self.pin(&cid).await?; + Ok(cid) + } + + async fn pin(&self, cid: &cid::Cid) -> Result<()> { + self.ipfs.insert_pin(cid, false).await.map_err(anyhow::Error::from) } pub async fn get_node(&self, cid: Cid) -> Result<Node> { |