diff --git a/bin/utils/seed_mpc_db.rs b/bin/utils/seed_mpc_db.rs index 289105c..1083837 100644 --- a/bin/utils/seed_mpc_db.rs +++ b/bin/utils/seed_mpc_db.rs @@ -1,10 +1,17 @@ +use std::sync::Arc; + use clap::Args; -use indicatif::ProgressBar; +use futures::stream::FuturesUnordered; +use futures::StreamExt; +use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; +use mpc::bits::Bits; use mpc::config::DbConfig; use mpc::db::Db; +use mpc::distance::EncodedBits; use mpc::rng_source::RngSource; use mpc::template::Template; -use rand::Rng; +use rand::{thread_rng, Rng}; +use rayon::iter::{IntoParallelIterator, ParallelIterator}; #[derive(Debug, Clone, Args)] pub struct SeedMPCDb { @@ -14,10 +21,10 @@ pub struct SeedMPCDb { #[clap(short, long)] pub participant_db_url: Vec, - #[clap(short, long, default_value = "3000000")] + #[clap(short, long, default_value = "100000")] pub num_templates: usize, - #[clap(short, long, default_value = "10000")] + #[clap(short, long, default_value = "100")] pub batch_size: usize, #[clap(short, long, env, default_value = "thread")] @@ -29,96 +36,237 @@ pub async fn seed_mpc_db(args: &SeedMPCDb) -> eyre::Result<()> { return Err(eyre::eyre!("No participant DBs provided")); } - let mut templates: Vec