block-db 0.2.0

Local, multi-threaded, durable byte DB.
Documentation
// // Authors: Robert Lopez

// use crate::{
//     data_file::{data_block::DataBlock, DataFile},
//     tests::{test_db::TestDB, util::random_bytes},
// };
// use tokio::time::Instant;

// #[tokio::test]
// async fn benchmark_writes() {
//     let chunk_size = 4_096;
//     let max_file_size = 4_096_000_000_000;

//     let test_db = TestDB::open("benchmark_writes", Some(chunk_size), Some(max_file_size))
//         .await
//         .unwrap();

//     let mut writes = vec![];
//     let mut total_bytes = 0;

//     for _ in 0..100 {
//         let bytes = chunk_size * 100;
//         total_bytes += bytes;

//         writes.push(random_bytes(bytes));
//     }

//     let start = Instant::now();

//     for write in writes {
//         test_db.block_db.write(write).await.unwrap();
//     }

//     let end = Instant::now();

//     println!(
//         "benchmark_writes -- Bytes: {total_bytes} in {}ms",
//         end.duration_since(start).as_millis()
//     );

//     test_db.cleanup().await.unwrap();
// }