diff --git a/lib/disk/src/lib.rs b/lib/disk/src/lib.rs index d3f888d1..4a7497b5 100644 --- a/lib/disk/src/lib.rs +++ b/lib/disk/src/lib.rs @@ -11,7 +11,7 @@ use std::path::Path; pub struct CatMapsOnDisk {} impl CatMapsOnDisk { - pub fn new(_: &Path, _: String) -> Self { + pub fn new(_: &Path, _: String, _:Option<&Path>) -> Self { unimplemented!("Contact Data Treehouse to try!") } diff --git a/lib/representation/src/cats/serialization.rs b/lib/representation/src/cats/serialization.rs index eaea8cdc..b560b8e6 100644 --- a/lib/representation/src/cats/serialization.rs +++ b/lib/representation/src/cats/serialization.rs @@ -76,29 +76,13 @@ impl Cats { serde_json::from_slice(&std::fs::read(metadata_file_path).unwrap()).unwrap(); let map = if let Some(storage_folder) = storage_folder { - let r: Result, CatSerializationError> = cats_metadata - .uuid_cat_type_map - .par_iter() - .map(|(id, ..)| { - // Remove the source base path to maintain directory structure - let src_path = create_path(&cat_path, id); - let dest_path = create_path(storage_folder, id); - - // Perform the copy - fs::copy(&src_path, &dest_path)?; - let mut perms = fs::metadata(dest_path)?.permissions(); - perms.set_readonly(false); - fs::set_permissions(&src_path, perms)?; - Ok(()) - }) - .collect(); - r?; let map: HashMap = cats_metadata .uuid_cat_type_map .par_iter() .map(|(id, t)| { - let cat_enc_path = create_path(storage_folder, id); - let cmod = CatMapsOnDisk::new(&cat_enc_path, t.name.clone()); + let src_path = create_path(&cat_path, id); + let dest_path = create_path(storage_folder, id); + let cmod = CatMapsOnDisk::new(&src_path, t.name.clone(), Some(&dest_path)); let cm = CatMaps::OnDisk(cmod); let ce = CatEncs { maps: cm }; (t.cat_type.clone(), ce) @@ -111,7 +95,7 @@ impl Cats { .par_iter() .map(|(id, t)| { let cat_enc_path = create_path(&cat_path, id); - let cmod = CatMapsOnDisk::new(&cat_enc_path, t.name.clone()); + let cmod = CatMapsOnDisk::new(&cat_enc_path, t.name.clone(), None); let cmim = cmod.to_memory(t.cat_type.as_base_rdf_node_type().is_iri()); let cm = CatMaps::InMemory(cmim); let ce = CatEncs { maps: cm };