Skip to content

Commit

Permalink
refactor: move crates to project home
Browse files Browse the repository at this point in the history
Signed-off-by: Tarek <[email protected]>
  • Loading branch information
tareknaser committed Feb 21, 2024
1 parent 3dd8458 commit 4193994
Show file tree
Hide file tree
Showing 23 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8> {
let mut rng = rand::thread_rng();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/fs-index/src/id.rs → fs-index/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
2 changes: 1 addition & 1 deletion crates/fs-index/src/index.rs → fs-index/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/fs-index/src/pdf.rs → fs-index/src/pdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4193994

Please sign in to comment.