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

Rename the arguments name for better clarification in insert example #463

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions firewood/examples/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ struct Args {
#[arg(short, long, default_value = "32", value_parser = string_to_range)]
datalen: RangeInclusive<usize>,
#[arg(short, long, default_value_t = 1)]
batch_keys: usize,
batch_size: usize,
#[arg(short, long, default_value_t = 100)]
inserts: usize,
number_of_batches: usize,
#[arg(short, long, default_value_t = 0, value_parser = clap::value_parser!(u16).range(0..=100))]
read_verify_percent: u16,
#[arg(short, long)]
Expand Down Expand Up @@ -54,7 +54,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
.await
.expect("db initiation should succeed");

let keys = args.batch_keys;
let keys = args.batch_size;
let start = Instant::now();

let mut rng = if let Some(seed) = args.seed {
Expand All @@ -63,7 +63,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
rand::rngs::StdRng::from_entropy()
};

for _ in 0..args.inserts {
for _ in 0..args.number_of_batches {
let keylen = rng.gen_range(args.keylen.clone());
let datalen = rng.gen_range(args.datalen.clone());
let batch: Batch<Vec<u8>, Vec<u8>> = (0..keys)
Expand Down Expand Up @@ -93,7 +93,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let duration = start.elapsed();
println!(
"Generated and inserted {} batches of size {keys} in {duration:?}",
args.inserts
args.number_of_batches
);

Ok(())
Expand Down
Loading