From 419399433f70bdbcbd19ecf35492150fbced46f0 Mon Sep 17 00:00:00 2001 From: Tarek Date: Wed, 21 Feb 2024 18:06:27 +0200 Subject: [PATCH] refactor: move crates to project home Signed-off-by: Tarek --- Cargo.toml | 3 ++- README.md | 2 +- {crates/fs-atomic-versions => fs-atomic-versions}/Cargo.toml | 0 .../fs-atomic-versions => fs-atomic-versions}/src/app_id.rs | 0 .../src/atomic/file.rs | 0 .../src/atomic/mod.rs | 0 {crates/fs-atomic-versions => fs-atomic-versions}/src/lib.rs | 0 {crates/fs-index => fs-index}/Cargo.toml | 0 .../fs-index => fs-index}/benches/compute_bytes_benchmark.rs | 3 +-- {crates/fs-index => fs-index}/benches/index_build_benchmark.rs | 2 +- {crates/fs-index => fs-index}/build.rs | 0 {crates/fs-index => fs-index}/src/id.rs | 2 +- {crates/fs-index => fs-index}/src/index.rs | 2 +- {crates/fs-index => fs-index}/src/lib.rs | 0 {crates/fs-index => fs-index}/src/link.rs | 0 {crates/fs-index => fs-index}/src/pdf.rs | 2 +- {crates/fs-index => fs-index}/src/storage/meta.rs | 0 {crates/fs-index => fs-index}/src/storage/mod.rs | 0 {crates/fs-index => fs-index}/src/storage/prop.rs | 0 {crates/fs-utils => fs-utils}/Cargo.toml | 0 {crates/fs-utils => fs-utils}/src/errors.rs | 0 {crates/fs-utils => fs-utils}/src/json.rs | 0 {crates/fs-utils => fs-utils}/src/lib.rs | 0 23 files changed, 8 insertions(+), 8 deletions(-) rename {crates/fs-atomic-versions => fs-atomic-versions}/Cargo.toml (100%) rename {crates/fs-atomic-versions => fs-atomic-versions}/src/app_id.rs (100%) rename {crates/fs-atomic-versions => fs-atomic-versions}/src/atomic/file.rs (100%) rename {crates/fs-atomic-versions => fs-atomic-versions}/src/atomic/mod.rs (100%) rename {crates/fs-atomic-versions => fs-atomic-versions}/src/lib.rs (100%) rename {crates/fs-index => fs-index}/Cargo.toml (100%) rename {crates/fs-index => fs-index}/benches/compute_bytes_benchmark.rs (94%) rename {crates/fs-index => fs-index}/benches/index_build_benchmark.rs (91%) rename {crates/fs-index => fs-index}/build.rs (100%) rename {crates/fs-index => fs-index}/src/id.rs (98%) rename {crates/fs-index => fs-index}/src/index.rs (99%) rename {crates/fs-index => fs-index}/src/lib.rs (100%) rename {crates/fs-index => fs-index}/src/link.rs (100%) rename {crates/fs-index => fs-index}/src/pdf.rs (96%) rename {crates/fs-index => fs-index}/src/storage/meta.rs (100%) rename {crates/fs-index => fs-index}/src/storage/mod.rs (100%) rename {crates/fs-index => fs-index}/src/storage/prop.rs (100%) rename {crates/fs-utils => fs-utils}/Cargo.toml (100%) rename {crates/fs-utils => fs-utils}/src/errors.rs (100%) rename {crates/fs-utils => fs-utils}/src/json.rs (100%) rename {crates/fs-utils => fs-utils}/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 1ca30b1c..5327f12d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] -members = ["crates/*"] +members = ["fs-atomic-versions", "fs-index", "fs-utils"] +default-members = ["fs-atomic-versions", "fs-index", "fs-utils"] resolver = "2" diff --git a/README.md b/README.md index b3178ab8..ef13bee9 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,6 @@ cargo bench index_build Our benchmark suite includes tests on local files and directories. These benchmarks are located in the [`benches/`](/benches) directory. Each benchmark sets a time limit using `group.measurement_time()`, which you can adjust manually based on your requirements. -You have the flexibility to benchmark specific files or folders by modifying the variables within the benchmark files. By default, the benchmarks operate on the [`testdata/`](../../testdata/) directory and its contents. You can change the directory/files by setting the `DIR_PATH` and `FILE_PATHS` variables to the desired values. +You have the flexibility to benchmark specific files or folders by modifying the variables within the benchmark files. By default, the benchmarks operate on the [`testdata/`](../testdata/) directory and its contents. You can change the directory/files by setting the `DIR_PATH` and `FILE_PATHS` variables to the desired values. For pre-benchmark assessment of required time to index a huge local folder, you can modify `test_build_resource_index` test case in `src/index.rs`. diff --git a/crates/fs-atomic-versions/Cargo.toml b/fs-atomic-versions/Cargo.toml similarity index 100% rename from crates/fs-atomic-versions/Cargo.toml rename to fs-atomic-versions/Cargo.toml diff --git a/crates/fs-atomic-versions/src/app_id.rs b/fs-atomic-versions/src/app_id.rs similarity index 100% rename from crates/fs-atomic-versions/src/app_id.rs rename to fs-atomic-versions/src/app_id.rs diff --git a/crates/fs-atomic-versions/src/atomic/file.rs b/fs-atomic-versions/src/atomic/file.rs similarity index 100% rename from crates/fs-atomic-versions/src/atomic/file.rs rename to fs-atomic-versions/src/atomic/file.rs diff --git a/crates/fs-atomic-versions/src/atomic/mod.rs b/fs-atomic-versions/src/atomic/mod.rs similarity index 100% rename from crates/fs-atomic-versions/src/atomic/mod.rs rename to fs-atomic-versions/src/atomic/mod.rs diff --git a/crates/fs-atomic-versions/src/lib.rs b/fs-atomic-versions/src/lib.rs similarity index 100% rename from crates/fs-atomic-versions/src/lib.rs rename to fs-atomic-versions/src/lib.rs diff --git a/crates/fs-index/Cargo.toml b/fs-index/Cargo.toml similarity index 100% rename from crates/fs-index/Cargo.toml rename to fs-index/Cargo.toml diff --git a/crates/fs-index/benches/compute_bytes_benchmark.rs b/fs-index/benches/compute_bytes_benchmark.rs similarity index 94% rename from crates/fs-index/benches/compute_bytes_benchmark.rs rename to fs-index/benches/compute_bytes_benchmark.rs index 8ed477e2..a0a6313c 100644 --- a/crates/fs-index/benches/compute_bytes_benchmark.rs +++ b/fs-index/benches/compute_bytes_benchmark.rs @@ -4,8 +4,7 @@ use pprof::criterion::{Output, PProfProfiler}; use rand::prelude::*; use std::fs; -const FILE_PATHS: [&str; 2] = - ["../../testdata/lena.jpg", "../../testdata/test.pdf"]; // Add files to benchmark here +const FILE_PATHS: [&str; 2] = ["../testdata/lena.jpg", "../testdata/test.pdf"]; // Add files to benchmark here fn generate_random_data(size: usize) -> Vec { let mut rng = rand::thread_rng(); diff --git a/crates/fs-index/benches/index_build_benchmark.rs b/fs-index/benches/index_build_benchmark.rs similarity index 91% rename from crates/fs-index/benches/index_build_benchmark.rs rename to fs-index/benches/index_build_benchmark.rs index a03fcce2..fc66cc1b 100644 --- a/crates/fs-index/benches/index_build_benchmark.rs +++ b/fs-index/benches/index_build_benchmark.rs @@ -4,7 +4,7 @@ use criterion::{ use fs_index::index::ResourceIndex; use pprof::criterion::{Output, PProfProfiler}; -const DIR_PATH: &str = "../../testdata/"; // Set the path to the directory containing the resources here +const DIR_PATH: &str = "../testdata/"; // Set the path to the directory containing the resources here fn index_build_benchmark(c: &mut Criterion) { // assert the path exists and is a directory diff --git a/crates/fs-index/build.rs b/fs-index/build.rs similarity index 100% rename from crates/fs-index/build.rs rename to fs-index/build.rs diff --git a/crates/fs-index/src/id.rs b/fs-index/src/id.rs similarity index 98% rename from crates/fs-index/src/id.rs rename to fs-index/src/id.rs index 4c12f3f3..77c44cdc 100644 --- a/crates/fs-index/src/id.rs +++ b/fs-index/src/id.rs @@ -122,7 +122,7 @@ mod tests { fn compute_id_test() { initialize(); - let file_path = Path::new("../../testdata/lena.jpg"); + let file_path = Path::new("../testdata/lena.jpg"); let data_size = fs::metadata(file_path) .unwrap_or_else(|_| { panic!( diff --git a/crates/fs-index/src/index.rs b/fs-index/src/index.rs similarity index 99% rename from crates/fs-index/src/index.rs rename to fs-index/src/index.rs index 69a281a4..f27bb7e9 100644 --- a/crates/fs-index/src/index.rs +++ b/fs-index/src/index.rs @@ -1149,7 +1149,7 @@ mod tests { fn test_build_resource_index() { use std::time::Instant; - let path = "../../testdata/"; // The path to the directory to index + let path = "../testdata/"; // The path to the directory to index assert!( std::path::Path::new(path).is_dir(), "The provided path is not a directory or does not exist" diff --git a/crates/fs-index/src/lib.rs b/fs-index/src/lib.rs similarity index 100% rename from crates/fs-index/src/lib.rs rename to fs-index/src/lib.rs diff --git a/crates/fs-index/src/link.rs b/fs-index/src/link.rs similarity index 100% rename from crates/fs-index/src/link.rs rename to fs-index/src/link.rs diff --git a/crates/fs-index/src/pdf.rs b/fs-index/src/pdf.rs similarity index 96% rename from crates/fs-index/src/pdf.rs rename to fs-index/src/pdf.rs index 6c3bcb15..021f374c 100644 --- a/crates/fs-index/src/pdf.rs +++ b/fs-index/src/pdf.rs @@ -70,7 +70,7 @@ fn test_multi_pdf_generate() { println!("temporary root: {}", root.display()); for i in 0..2 { use std::fs::File; - let pdf_reader = File::open("../../testdata/test.pdf").unwrap(); + let pdf_reader = File::open("../testdata/test.pdf").unwrap(); println!("Rendering {}", &i); let img = render_preview_page(pdf_reader, PDFQuality::High); diff --git a/crates/fs-index/src/storage/meta.rs b/fs-index/src/storage/meta.rs similarity index 100% rename from crates/fs-index/src/storage/meta.rs rename to fs-index/src/storage/meta.rs diff --git a/crates/fs-index/src/storage/mod.rs b/fs-index/src/storage/mod.rs similarity index 100% rename from crates/fs-index/src/storage/mod.rs rename to fs-index/src/storage/mod.rs diff --git a/crates/fs-index/src/storage/prop.rs b/fs-index/src/storage/prop.rs similarity index 100% rename from crates/fs-index/src/storage/prop.rs rename to fs-index/src/storage/prop.rs diff --git a/crates/fs-utils/Cargo.toml b/fs-utils/Cargo.toml similarity index 100% rename from crates/fs-utils/Cargo.toml rename to fs-utils/Cargo.toml diff --git a/crates/fs-utils/src/errors.rs b/fs-utils/src/errors.rs similarity index 100% rename from crates/fs-utils/src/errors.rs rename to fs-utils/src/errors.rs diff --git a/crates/fs-utils/src/json.rs b/fs-utils/src/json.rs similarity index 100% rename from crates/fs-utils/src/json.rs rename to fs-utils/src/json.rs diff --git a/crates/fs-utils/src/lib.rs b/fs-utils/src/lib.rs similarity index 100% rename from crates/fs-utils/src/lib.rs rename to fs-utils/src/lib.rs