summaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs8
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> {