summaryrefslogtreecommitdiff
path: root/src/chunker/rw/storage/write
diff options
context:
space:
mode:
Diffstat (limited to 'src/chunker/rw/storage/write')
-rw-r--r--src/chunker/rw/storage/write/simple.rs16
-rw-r--r--src/chunker/rw/storage/write/stream.rs6
2 files changed, 13 insertions, 9 deletions
diff --git a/src/chunker/rw/storage/write/simple.rs b/src/chunker/rw/storage/write/simple.rs
index 38aecfc..461afff 100644
--- a/src/chunker/rw/storage/write/simple.rs
+++ b/src/chunker/rw/storage/write/simple.rs
@@ -87,16 +87,20 @@ async fn write_file_to_storage(
trace!("file_size={}", raw_data.len());
trace!("output_index_file={}", output_index_file.display());
trace!("policy_name={:?}", ctx.policy_name);
- trace!("storage_dir={}", ctx.output_dir.display());
+ trace!(
+ "storage_dir={}",
+ ctx.storage_path.as_ref().unwrap().display()
+ );
info!(
"{} chunks will be written to {}",
chunk_count,
- ctx.output_dir.display()
+ ctx.storage_path.as_ref().unwrap().display()
);
- tokio::fs::create_dir_all(&ctx.output_dir).await?;
- trace!("Output directory created or already exists");
+ let storage_dir = ctx.storage_path.as_ref().unwrap().clone();
+ tokio::fs::create_dir_all(&storage_dir).await?;
+ trace!("Storage directory created or already exists");
let mut tasks = Vec::new();
let mut start = 0;
@@ -119,7 +123,7 @@ async fn write_file_to_storage(
progress_name: progress_name.clone(),
step,
chunk_data: chunk_data.to_vec(),
- output_dir: ctx.output_dir.clone(),
+ output_dir: ctx.storage_path.as_ref().unwrap().clone(),
chunk_hash: ctx.chunk_hash,
chunk_index,
};
@@ -149,7 +153,7 @@ async fn write_file_to_storage(
progress_name: progress_name.clone(),
step,
chunk_data: chunk_data.to_vec(),
- output_dir: ctx.output_dir.clone(),
+ output_dir: ctx.storage_path.as_ref().unwrap().clone(),
chunk_hash: ctx.chunk_hash,
chunk_index,
};
diff --git a/src/chunker/rw/storage/write/stream.rs b/src/chunker/rw/storage/write/stream.rs
index 092cee7..74a391b 100644
--- a/src/chunker/rw/storage/write/stream.rs
+++ b/src/chunker/rw/storage/write/stream.rs
@@ -42,7 +42,7 @@ pub async fn write_file_stream(
// Collect chunk information
let chunk_infos = Arc::new(Mutex::new(Vec::new()));
let chunk_counter = Arc::new(Mutex::new(0usize));
- let output_dir = ctx.output_dir.clone();
+ let storage_dir = ctx.storage_path.as_ref().unwrap().clone();
let chunk_hash = ctx.chunk_hash;
// If only displaying boundaries, use chunk_stream_display_boundaries
@@ -80,7 +80,7 @@ pub async fn write_file_stream(
stream_read_size,
path,
|chunk_data: Vec<u8>| {
- let output_dir = output_dir.clone();
+ let storage_dir = storage_dir.clone();
let chunk_hash = chunk_hash;
let progress_name = progress_name.clone();
let chunk_infos = Arc::clone(&chunk_infos);
@@ -97,7 +97,7 @@ pub async fn write_file_stream(
let hash_hex = hex::encode(hash_bytes);
// Build file path
- let file_path = get_chunk_path(&output_dir, &hash_hex);
+ let file_path = get_chunk_path(&storage_dir, &hash_hex);
// Create directory if needed
if let Some(parent_dir) = file_path.parent() {