summaryrefslogtreecommitdiffstats
path: root/src/backend/backend.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-04-06 17:06:11 +0200
committerMatthias Beyer <mail@beyermatthias.de>2021-04-06 17:06:11 +0200
commitfa655bbe8acae9c7f5d46e977ebea01ac0572327 (patch)
treeba1617c161214df4e589f931cf205ef383a3e52c /src/backend/backend.rs
parenta70d760dd4d24d2d2963f6e48e3fec027f1e8305 (diff)
Implement first CLI
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/backend/backend.rs')
-rw-r--r--src/backend/backend.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/backend.rs b/src/backend/backend.rs
index 3e00f0f..33a8906 100644
--- a/src/backend/backend.rs
+++ b/src/backend/backend.rs
@@ -43,6 +43,13 @@ impl IpfsEmbedBackend {
ipfs_embed::Ipfs::new(config).await.map(Arc::new).map(|ipfs| IpfsEmbedBackend { ipfs })
}
+ pub async fn new_with_config(cfg: ipfs_embed::Config) -> Result<Self> {
+ ipfs_embed::Ipfs::new(cfg)
+ .await
+ .map(Arc::new)
+ .map(|ipfs| IpfsEmbedBackend { ipfs })
+ }
+
pub async fn write_payload(&self, payload: &crate::backend::Payload) -> Result<cid::Cid> {
let block = libipld::block::Block::encode(libipld::cbor::DagCborCodec, libipld::multihash::Code::Blake3_256, &payload)?;
self.ipfs