Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/benchmark multitier #198

Merged
merged 173 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
eed044d
feat: sorted_limbs chip checking each limb less than limb_bits bits
bfan05 May 29, 2024
473670c
wip
OsamaAlkhodairy May 29, 2024
8792d55
Merge branch 'main' into feat/page_read_write_checker
OsamaAlkhodairy May 29, 2024
023c034
feat: completed sorted_limbs chip with tests
bfan05 May 30, 2024
4c21140
Merge branch 'main' into feat/sort-limbs
bfan05 May 30, 2024
f080051
wip
OsamaAlkhodairy May 31, 2024
6a7fafd
Merge branch 'main' into feat/page_read_write_checker
OsamaAlkhodairy May 31, 2024
a5c0982
feat: SortedLimbsChip with LessThan subchip
bfan05 May 31, 2024
06ada4b
feat: less_than subchip refactored
bfan05 May 31, 2024
0caddfd
chore: merge main
bfan05 May 31, 2024
b349571
feat: rename SortedLimbsChip to AssertSortedChip and write LessThanCh…
bfan05 May 31, 2024
dbada83
chore: change name of assert sorted chip
bfan05 May 31, 2024
b62172a
chore: fix names in tests for AssertSortedChip
bfan05 May 31, 2024
7f8daba
Merge branch 'main' into feat/page_read_write_checker
OsamaAlkhodairy Jun 2, 2024
0cf5509
Merge branch 'main' into feat/sort-limbs
bfan05 Jun 3, 2024
451f4c4
chore: address comments
bfan05 Jun 3, 2024
d77fd08
chore: cleanup
bfan05 Jun 3, 2024
c320b27
Merge branch 'main' into feat/sort-limbs
bfan05 Jun 3, 2024
3c81318
chore: change MAX from generic to instance field for LessThanChip and…
bfan05 Jun 3, 2024
00f38a4
wip: added extra bits to middle chip trace
OsamaAlkhodairy Jun 3, 2024
1aa7cea
Merge branch 'main' into feat/page_read_write_checker
OsamaAlkhodairy Jun 3, 2024
f0c371d
wip
OsamaAlkhodairy Jun 3, 2024
7a7cf4c
adding connection to IsEqualVec chip
OsamaAlkhodairy Jun 4, 2024
296b66f
feat: IsLessThanChip to compare two numbers
bfan05 Jun 4, 2024
c860b80
Merge branch 'main' into feat/sort-limbs
bfan05 Jun 4, 2024
3610e0d
feat: IsLessThanTuple subchip for different limb_bits
bfan05 Jun 4, 2024
8dac425
test: added tests for partially and non-allocated pages
OsamaAlkhodairy Jun 4, 2024
295b3c8
Merge branch 'main' into feat/page_read_write_checker
OsamaAlkhodairy Jun 4, 2024
3811b1c
test: added negative tests
OsamaAlkhodairy Jun 4, 2024
b755a28
added constraints
OsamaAlkhodairy Jun 4, 2024
2ab6964
adding comments
OsamaAlkhodairy Jun 4, 2024
50d54a4
feat: IsLessThanTupleChip subchip in AssertSortedChip
bfan05 Jun 4, 2024
12949c8
renaming
OsamaAlkhodairy Jun 4, 2024
8db7282
removing TODO comments
OsamaAlkhodairy Jun 4, 2024
d35655a
Merge branch 'feat/sort-limbs' into feat/page_read_write_checker
OsamaAlkhodairy Jun 4, 2024
1748721
fixing clippy
OsamaAlkhodairy Jun 4, 2024
ce03626
Add MVP bin
ytham Jun 5, 2024
fcfe0cc
Add MVP bin
ytham Jun 5, 2024
9d3199e
Merge branch 'feat/query-binary' of github.com:axiom-crypto/afs-proto…
ytham Jun 5, 2024
9fe511a
chore: renaming to idx and data
OsamaAlkhodairy Jun 5, 2024
d0ae2cf
chore: address comments first pass
bfan05 Jun 5, 2024
81494d9
Merge branch 'main' into feat/sort-limbs
bfan05 Jun 5, 2024
0099324
chore: moving page_controller inside page_read
OsamaAlkhodairy Jun 5, 2024
664ca0f
Merge branch 'main' into feat/page_read_write_checker
OsamaAlkhodairy Jun 5, 2024
6ca339f
chore: refactor AssertSorted, IsEqual, IsLessThan, and IsLessThanTupl…
bfan05 Jun 5, 2024
aef744a
chore: address comments
bfan05 Jun 5, 2024
5ef5344
Update cache command
ytham Jun 5, 2024
782cd0f
Refactor cmd line items
ytham Jun 5, 2024
38d5dec
chore: eliminate high dim poly from IsLessThanTupleChip
bfan05 Jun 5, 2024
d76a94d
chore: fix tests
bfan05 Jun 5, 2024
eca7ef3
chore: address comments for AssertSortedChip
bfan05 Jun 6, 2024
4890798
chore: cleanup AssertSorted
bfan05 Jun 6, 2024
a086260
chore: cleanup
bfan05 Jun 6, 2024
6896610
chore: include roundtrip flatten and from_slice tests
bfan05 Jun 6, 2024
7c23b03
feat: flatten and from_slice for IO and Aux columns
bfan05 Jun 6, 2024
4ad8d5d
wip
MonkeyKing-1 Jun 6, 2024
64dda36
Merge branch 'feat/sort-limbs' of github.com:axiom-crypto/afs-prototy…
MonkeyKing-1 Jun 6, 2024
771c2a6
wip
MonkeyKing-1 Jun 7, 2024
f62e1bf
merge new sort features
MonkeyKing-1 Jun 7, 2024
aa7a132
complete the merge
MonkeyKing-1 Jun 7, 2024
ed6bfc3
apparently there were more diffs
MonkeyKing-1 Jun 7, 2024
28be1cd
most of testing infra done
MonkeyKing-1 Jun 7, 2024
0f1b2cc
most of testing infra done
MonkeyKing-1 Jun 7, 2024
32f9c1f
finish merge
MonkeyKing-1 Jun 10, 2024
5be7d05
finish merging again
MonkeyKing-1 Jun 10, 2024
dec4535
feat: write tests for general case
MonkeyKing-1 Jun 11, 2024
898d527
Merge branch 'main' of github.com:axiom-crypto/afs-prototype into fea…
MonkeyKing-1 Jun 11, 2024
1a39217
add btree implementation
MonkeyKing-1 Jun 12, 2024
22c8ffb
chore: do some refactors
MonkeyKing-1 Jun 12, 2024
888003c
Merge branch 'main' of github.com:axiom-crypto/afs-prototype into fea…
ytham Jun 12, 2024
53d4652
Merge main
ytham Jun 13, 2024
1d30e42
Mock subcommand + logical interface updates
ytham Jun 13, 2024
b0d4e10
Update interface for reading db
ytham Jun 13, 2024
d181923
Change interface to read
ytham Jun 13, 2024
ad83c52
Change interface to read
ytham Jun 13, 2024
e6f0984
Add write command
ytham Jun 13, 2024
fa34c68
Add output command for write
ytham Jun 13, 2024
de2b2e3
chore: appease clippy (partially)
MonkeyKing-1 Jun 13, 2024
a3e475e
Feat/m1 execution air (#66)
MonkeyKing-1 Jun 13, 2024
e551058
Add print flag to afi command, update readmes
ytham Jun 13, 2024
2cea7ba
Merge branch 'feat/query-binary' of github.com:axiom-crypto/afs-proto…
ytham Jun 13, 2024
019d78d
Update warnings
ytham Jun 13, 2024
e7ce2b9
wip keygen
MonkeyKing-1 Jun 13, 2024
22dd404
finish merge
MonkeyKing-1 Jun 13, 2024
22f4b82
wip: start prove
MonkeyKing-1 Jun 13, 2024
d7b3791
Predicate
ytham Jun 13, 2024
811310b
wip: prove and verify
MonkeyKing-1 Jun 13, 2024
ec8639f
change branches
zlangley Jun 13, 2024
b86515a
Add to_page for Table
ytham Jun 13, 2024
8e4d565
Use btreemap
ytham Jun 14, 2024
2510781
Merge branch 'feat/query-binary' of github.com:axiom-crypto/afs-proto…
ytham Jun 14, 2024
edc37d5
Update functions
ytham Jun 14, 2024
9a02e0d
Update page to/from
ytham Jun 14, 2024
4cdfe07
Update tests
ytham Jun 14, 2024
a5663d9
Add predicate binary
ytham Jun 14, 2024
ec39f03
wip: proof not serializable
zlangley Jun 13, 2024
4813894
finish merge
MonkeyKing-1 Jun 14, 2024
5f1fece
chore: patch stuff
MonkeyKing-1 Jun 14, 2024
f4dd631
add serde bounds
jonathanpwang Jun 14, 2024
7c79646
feat: zk commands (not debugged yet)
MonkeyKing-1 Jun 14, 2024
4e4d2e5
update mockdb
ytham Jun 14, 2024
46782db
wip: mold into new format
MonkeyKing-1 Jun 14, 2024
7c07089
chore: remove extraneous stuff
MonkeyKing-1 Jun 14, 2024
9bb4a7d
[WIP: query-binary] Merge r/w changes (#69)
ytham Jun 17, 2024
1f316ca
feat: merge main and cleanup
MonkeyKing-1 Jun 17, 2024
44ce8da
Tmp: remove predicate
ytham Jun 17, 2024
5326a8c
Resolve merge conflicts
ytham Jun 17, 2024
2e19a54
Update readme
ytham Jun 17, 2024
2fb1947
clean up code
MonkeyKing-1 Jun 17, 2024
7a044bb
feat: rename chips to airs
MonkeyKing-1 Jun 17, 2024
bbb6681
Merge branch 'main' of github.com:axiom-crypto/afs-prototype into fea…
MonkeyKing-1 Jun 17, 2024
3caac57
feat: fix duplication attack
MonkeyKing-1 Jun 17, 2024
7edb798
Update commands for newest rows
ytham Jun 17, 2024
da8889b
feat: migrate to bincode
MonkeyKing-1 Jun 17, 2024
c9e0050
finish merge
MonkeyKing-1 Jun 17, 2024
47335af
finish merge
MonkeyKing-1 Jun 17, 2024
2965b83
feat: add tracing and switch default fri params to log_blowup_factor = 3
jonathanpwang Jun 18, 2024
4a1641b
chore: update logging
jonathanpwang Jun 18, 2024
ff8c9df
Fix readme typo
ytham Jun 18, 2024
14cdaa5
Merge branch 'feat/query-binary' of github.com:axiom-crypto/afs-proto…
ytham Jun 18, 2024
68aad34
Fix clippy warnings
ytham Jun 18, 2024
08cc9d3
finish merge
MonkeyKing-1 Jun 18, 2024
cc2db8d
Merge branch 'feat/query-binary' of github.com:axiom-crypto/afs-proto…
MonkeyKing-1 Jun 18, 2024
2d20cf3
add afs-1b folder
MonkeyKing-1 Jun 18, 2024
fe10dc9
Merge branch 'main' of github.com:axiom-crypto/afs-prototype into fea…
MonkeyKing-1 Jun 18, 2024
6822893
Merge branch 'main' into feat/query-binary
jonathanpwang Jun 18, 2024
9f02efc
Update to handle input byte lengths
ytham Jun 18, 2024
9bad23e
Remove extraneous code
ytham Jun 18, 2024
b322ecb
Revert 9f02efc1bd6d658bda7c7b79f74cafa5ee87bb6c^..9bad23e28c941d33fc2…
ytham Jun 19, 2024
b0b78bd
feat: working query binary
MonkeyKing-1 Jun 19, 2024
4d2c63a
add config file
MonkeyKing-1 Jun 19, 2024
b1eadfd
Update logical interface to add byte lengths
ytham Jun 19, 2024
de0a3ef
Remove generics from logical-interface
ytham Jun 19, 2024
8310cdb
Merge branch 'main' into feat/query-binary
OsamaAlkhodairy Jun 20, 2024
68397d6
finish main merge
MonkeyKing-1 Jun 20, 2024
30bfd22
merging new Offline Checker changes
OsamaAlkhodairy Jun 20, 2024
2ff13db
Merge branch 'main' into feat/query-binary
OsamaAlkhodairy Jun 20, 2024
b1527d3
finish merge with feat/query-binary
MonkeyKing-1 Jun 20, 2024
1836f15
merge main
MonkeyKing-1 Jun 20, 2024
9de1ec4
merge main
MonkeyKing-1 Jun 20, 2024
8d33b66
change page format
MonkeyKing-1 Jun 20, 2024
00540e4
merge new multitier_page_rw updates
MonkeyKing-1 Jun 20, 2024
da1123e
feat: remove btree generics
MonkeyKing-1 Jun 20, 2024
4ce3595
merge feat/multitier_page_rw
MonkeyKing-1 Jun 20, 2024
8f02bec
feat: binsearch optimization for btree
MonkeyKing-1 Jun 20, 2024
8f6fe51
merge btree updates
MonkeyKing-1 Jun 20, 2024
3c52b30
feat: add 1b scripting
MonkeyKing-1 Jun 21, 2024
273fcc6
wip
Jul 11, 2024
e778ab4
finish merge
Jul 11, 2024
fe79381
finish merge
Jul 11, 2024
09dc37c
wip: resolve provertracedata cloen issue
Jul 11, 2024
479752b
benchmark multitier
Jul 19, 2024
56b2c93
finish changes
Jul 22, 2024
c4e246a
finish merge
Jul 22, 2024
86dd35a
wip
Jul 22, 2024
8d33489
wip
Jul 23, 2024
201b164
wip
Jul 24, 2024
d76c95c
merge main
Jul 24, 2024
429f9e6
wip
Jul 24, 2024
ef29c24
merge main
Jul 24, 2024
ab8c9ea
finish merge
Jul 25, 2024
766f842
finish merge
Jul 25, 2024
c86c7df
finish merging
Jul 25, 2024
54d881c
finish cleaning
Jul 26, 2024
70a689e
move files
Jul 26, 2024
0efdfcf
fix cargo.toml
Jul 26, 2024
b620921
wip
Jul 29, 2024
f22ff0b
finish merge
Jul 29, 2024
2cee3b7
wip
Jul 29, 2024
b5d9c77
finish requested changes
Jul 30, 2024
86e2a1e
Merge branch 'main' into feat/benchmark_multitier
MonkeyKing-1 Jul 30, 2024
4c9f93c
fix leaf trace gen
Jul 30, 2024
582df3b
edit comment
Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,597 changes: 3,597 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[workspace]
members = [
"bin/common",
"bin/afs",
"bin/afs-1b",
"bin/olap",
"benchmark",
"db/page",
Expand Down Expand Up @@ -104,4 +106,4 @@ zkhash = { git = "https://github.com/HorizenLabs/poseidon2.git", rev = "bb476b9"
# p3-symmetric = { path = "../Plonky3/symmetric" }
# p3-uni-stark = { path = "../Plonky3/uni-stark" }
# p3-maybe-rayon = { path = "../Plonky3/maybe-rayon" }
# p3-bn254-fr = { path = "../Plonky3/bn254-fr" }
# p3-bn254-fr = { path = "../Plonky3/bn254-fr" }
1 change: 1 addition & 0 deletions benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition.workspace = true
[dependencies]
csv = "1.3.0"
afs = { path = "../bin/afs", default-features = false }
afs-1b = { path = "../bin/afs-1b", default-features = false }
olap = { path = "../bin/olap", default-features = false }
afs-stark-backend = { path = "../stark-backend", default-features = false }
logical-interface = { path = "../logical-interface" }
Expand Down
10 changes: 10 additions & 0 deletions benchmark/README.md
MonkeyKing-1 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ Pass in an .afo file that contains the predicate instruction. Example .afo file:
FILTER 0xfade INDEX <= 0xdac0
```

## Predicate

Run this command for multitier read/write

```bash
RUSTFLAGS="-Ctarget-cpu=native" cargo run --release --bin benchmark -- mtrw -n -i 0
```

This command goes through many configs, including large and small page heights. We run benchmarks on the case that n leaves are revealed via n insert operations, where n is 1 or 8. To account for the worst case scenario, we double the leaves in the final tree for certain configs (so 2n). The -n flag tells it to use a new, empty Btree (this should always be on, I haven't implemented large tree yet). The -i flag decides where to start the benchmarking, in terms of config #. To directly jump to worst case testing, setting -i to 8 suffices.

## Additional test commands

To run only small configs for testing
Expand Down
32 changes: 29 additions & 3 deletions benchmark/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ use olap::commands::parse_afo_file;

use crate::{
commands::{
benchmark::benchmark_execute,
benchmark::{benchmark_execute, benchmark_multitier_execute},
multitier_rw::{run_mtrw_bench, MultitierRwCommand},
predicate::{run_bench_predicate, PredicateCommand},
rw::{run_bench_rw, RwCommand},
},
config::benchmark_data::{benchmark_data_predicate, benchmark_data_rw},
utils::table_gen::{generate_incremental_afi_rw, generate_random_afi_rw},
config::benchmark_data::{
benchmark_data_multitier_rw, benchmark_data_predicate, benchmark_data_rw,
},
utils::table_gen::{
generate_incremental_afi_rw, generate_random_afi_rw, generate_random_multitier_afi_rw,
},
};

#[derive(Debug, Parser)]
Expand All @@ -21,6 +26,10 @@ pub struct Cli {

#[derive(Debug, Subcommand)]
pub enum Commands {
#[command(name = "mtrw", about = "Benchmark Multitier Read/Write")]
/// Read/Write functions
MtRw(MultitierRwCommand),

#[command(name = "rw", about = "Benchmark Read/Write")]
/// Read/Write functions
Rw(RwCommand),
Expand All @@ -34,6 +43,23 @@ impl Cli {
pub fn run() {
let cli = Self::parse();
match cli.command {
Commands::MtRw(mtrw) => {
let benchmark_name = "MultitierReadWrite".to_string();
let scenario = format!("New Tree: {}", mtrw.new_tree);
let common = mtrw.common;
let extra_data = format!("{}", mtrw.new_tree);
benchmark_multitier_execute(
benchmark_name,
scenario,
common,
extra_data,
mtrw.start_idx,
run_mtrw_bench,
benchmark_data_multitier_rw,
generate_random_multitier_afi_rw,
)
.unwrap();
}
Commands::Rw(rw) => {
let benchmark_name = "ReadWrite".to_string();
let scenario = format!("r{}%, w{}%", rw.percent_reads, rw.percent_writes);
Expand Down
124 changes: 114 additions & 10 deletions benchmark/src/commands/benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
use std::{collections::HashMap, fs, path::Path, time::Instant};

use afs_test_utils::page_config::PageConfig;
use afs_test_utils::page_config::{MultitierPageConfig, PageConfig};
use chrono::Local;
use color_eyre::eyre::Result;

use crate::{
config::{benchmark_data::BenchmarkData, config_gen::get_configs},
config::{
benchmark_data::BenchmarkData,
config_gen::{get_configs, get_multitier_configs},
},
utils::{
output_writer::{
default_output_filename, save_afi_to_new_db, write_csv_header, write_csv_line,
default_output_filename, multitier_page_config_to_row, page_config_to_row,
save_afi_to_new_db, write_csv_header, write_csv_line,
},
tracing::{clear_tracing_log, extract_event_data_from_log, extract_timing_data_from_log},
},
AFI_FILE_PATH, DB_FILE_PATH, TABLE_ID, TMP_FOLDER, TMP_TRACING_LOG,
AFI_FILE_PATH, DB_FILE_PATH, MULTITIER_TABLE_ID, TABLE_ID, TMP_FOLDER, TMP_TRACING_LOG,
};

use super::CommonCommands;
Expand Down Expand Up @@ -132,14 +136,114 @@ pub fn benchmark_execute(
let mut log_data: HashMap<String, String> = event_data;
log_data.extend(timing_data);

write_csv_line(
output_file.clone(),
benchmark_name.clone(),
scenario.clone(),
let init_row = page_config_to_row(benchmark_name.clone(), scenario.clone(), config);
write_csv_line(output_file.clone(), init_row, &benchmark_data, &log_data)?;
}

println!("Benchmark [{}: {}] completed.", benchmark_name, scenario);

Ok(())
}

/// Function for setting up the benchmark
pub fn benchmark_multitier_setup(
benchmark_name: String,
config_folder: Option<String>,
output_file: Option<String>,
benchmark_data: &BenchmarkData,
) -> (Vec<MultitierPageConfig>, String) {
// Generate/Parse config(s)
let configs = get_multitier_configs(config_folder);

// Create tmp folder
let _ = fs::create_dir_all(TMP_FOLDER);

// Write .csv file
let output_file = output_file
.clone()
.unwrap_or(default_output_filename(benchmark_name.clone()));

println!("Output file: {}", output_file.clone());
write_csv_header(
output_file.clone(),
benchmark_data.sections.clone(),
benchmark_data.headers.clone(),
)
.unwrap();

(configs, output_file)
}

#[allow(clippy::too_many_arguments)]
pub fn benchmark_multitier_execute(
MonkeyKing-1 marked this conversation as resolved.
Show resolved Hide resolved
benchmark_name: String,
scenario: String,
common: CommonCommands,
extra_data: String,
start_idx: usize,
benchmark_fn: fn(&MultitierPageConfig, String) -> Result<()>,
benchmark_data_fn: fn() -> BenchmarkData,
afi_gen_fn: fn(&MultitierPageConfig, String, String) -> Result<()>,
) -> Result<()> {
println!("Executing [{}: {}] benchmark...", benchmark_name, scenario);
let benchmark_data = benchmark_data_fn();
let (configs, output_file) = benchmark_multitier_setup(
benchmark_name.clone(),
common.config_folder.clone(),
common.output_file.clone(),
&benchmark_data,
);
let configs_len = configs.len();
println!("Output file: {}", output_file.clone());

// Run benchmark for each config
for (idx, config) in configs.iter().rev().enumerate() {
if idx < start_idx {
continue;
}
let timestamp = Local::now().format("%H:%M:%S");
println!(
"[{}] Running config {:?}: {} of {}",
timestamp,
config.generate_filename(),
idx + 1,
configs_len
);

clear_tracing_log(TMP_TRACING_LOG.as_str())?;

// Generate AFI file
let generate_afi_instant = Instant::now();
afi_gen_fn(
config,
&benchmark_data,
&log_data,
MULTITIER_TABLE_ID.to_string(),
AFI_FILE_PATH.to_string(),
)?;
let generate_afi_duration = generate_afi_instant.elapsed();
println!("Setup: generate AFI duration: {:?}", generate_afi_duration);

// Run the benchmark function
benchmark_fn(config, extra_data.clone()).unwrap();

let event_data = extract_event_data_from_log(
TMP_TRACING_LOG.as_str(),
benchmark_data.event_filters.clone(),
)?;
let timing_data = extract_timing_data_from_log(
TMP_TRACING_LOG.as_str(),
benchmark_data.timing_filters.clone(),
)?;

println!("Config: {:?}", config);
println!("Event data: {:?}", event_data);
println!("Timing data: {:?}", timing_data);
println!("Output file: {}", output_file.clone());

let mut log_data: HashMap<String, String> = event_data;
log_data.extend(timing_data);
let init_row =
multitier_page_config_to_row(benchmark_name.clone(), scenario.clone(), config);
write_csv_line(output_file.clone(), init_row, &benchmark_data, &log_data)?;
}

println!("Benchmark [{}: {}] completed.", benchmark_name, scenario);
Expand Down
18 changes: 17 additions & 1 deletion benchmark/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use std::fs;

use afs_test_utils::page_config::PageConfig;
use afs_test_utils::page_config::{MultitierPageConfig, PageConfig};
use clap::Parser;
use color_eyre::eyre::Result;

pub mod multitier_rw;

pub mod benchmark;
pub mod predicate;
pub mod rw;
Expand Down Expand Up @@ -48,3 +50,17 @@ pub fn parse_config_folder(config_folder: String) -> Vec<PageConfig> {
}
configs
}

pub fn parse_multitier_config_folder(config_folder: String) -> Vec<MultitierPageConfig> {
let mut configs = Vec::new();
if let Ok(entries) = fs::read_dir(config_folder) {
for entry in entries.filter_map(Result::ok) {
let path = entry.path();
if path.is_file() && path.extension().and_then(|s| s.to_str()) == Some("toml") {
let config = MultitierPageConfig::read_config_file(path.to_str().unwrap());
configs.push(config);
}
}
}
configs
}
Loading
Loading