Skip to content

Commit

Permalink
reenable blobs related fns
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn committed Nov 7, 2024
1 parent 979c33a commit cad1d0b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/rpc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,8 @@ where
mod tests {
use iroh_blobs::util::local_pool::LocalPool;
use iroh_gossip::net::GOSSIP_ALPN;
use rand::RngCore;
use tokio::io::AsyncWriteExt;
// use rand::RngCore;
// use tokio::io::AsyncWriteExt;
use tracing::warn;

use super::*;
Expand Down
67 changes: 32 additions & 35 deletions src/rpc/docs_handle_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use anyhow::anyhow;
use futures_lite::{Stream, StreamExt};
use iroh_blobs::{
export::ExportProgress,
store::ImportProgress,
store::{ExportFormat, ImportProgress},
util::progress::{AsyncChannelProgressSender, ProgressSender},
BlobFormat,
BlobFormat, HashAndFormat,
};

use super::{
Expand Down Expand Up @@ -478,26 +478,24 @@ impl<D: iroh_blobs::store::Store> Engine<D> {
false => ImportMode::Copy,
};

todo!()
// let blobs = self.blobs();
// let (temp_tag, size) = blobs
// .store()
// .import_file(root, import_mode, BlobFormat::Raw, import_progress)
// .await?;

// let hash_and_format = temp_tag.inner();
// let HashAndFormat { hash, .. } = *hash_and_format;
// self.doc_set_hash(SetHashRequest {
// doc_id,
// author_id,
// key: key.clone(),
// hash,
// size,
// })
// .await?;
// drop(temp_tag);
// progress.send(DocImportProgress::AllDone { key }).await?;
// Ok(())
let blobs = self.blob_store();
let (temp_tag, size) = blobs
.import_file(root, import_mode, BlobFormat::Raw, import_progress)
.await?;

let hash_and_format = temp_tag.inner();
let HashAndFormat { hash, .. } = *hash_and_format;
self.doc_set_hash(SetHashRequest {
doc_id,
author_id,
key: key.clone(),
hash,
size,
})
.await?;
drop(temp_tag);
progress.send(DocImportProgress::AllDone { key }).await?;
Ok(())
}

pub(super) fn doc_export_file(
Expand Down Expand Up @@ -533,18 +531,17 @@ impl<D: iroh_blobs::store::Store> Engine<D> {
x
});

todo!()
// let blobs = self.blobs();
// iroh_blobs::export::export(
// blobs.store(),
// entry.content_hash(),
// path,
// ExportFormat::Blob,
// mode,
// export_progress,
// )
// .await?;
// progress.send(ExportProgress::AllDone).await?;
// Ok(())
let blobs = self.blob_store();
iroh_blobs::export::export(
blobs,
entry.content_hash(),
path,
ExportFormat::Blob,
mode,
export_progress,
)
.await?;
progress.send(ExportProgress::AllDone).await?;
Ok(())
}
}

0 comments on commit cad1d0b

Please # to comment.