From 599663d054267d86535ac31fde3078ad16ca11c0 Mon Sep 17 00:00:00 2001 From: ehsan Date: Sat, 23 Nov 2024 22:21:42 -0500 Subject: [PATCH] fmt --- src/blockstore.rs | 2 +- src/kvstore.rs | 2 +- src/lib.rs | 2 +- src/private_forest.rs | 14 ++++++-------- src/private_forest/private_forest_tests.rs | 6 ------ 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/blockstore.rs b/src/blockstore.rs index 66f53e2..b7b82aa 100644 --- a/src/blockstore.rs +++ b/src/blockstore.rs @@ -82,4 +82,4 @@ impl<'a> BlockStore for FFIFriendlyBlockStore<'a> { //-------------------------------------------------------------------------------------------------- #[cfg(test)] -mod blockstore_tests; \ No newline at end of file +mod blockstore_tests; diff --git a/src/kvstore.rs b/src/kvstore.rs index 740be86..849c9de 100644 --- a/src/kvstore.rs +++ b/src/kvstore.rs @@ -54,4 +54,4 @@ impl<'a> FFIStore<'a> for KVBlockStore { bucket.set(&key, &value)?; Ok(()) } -} \ No newline at end of file +} diff --git a/src/lib.rs b/src/lib.rs index 4b04fb8..6ceaaf2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,3 @@ pub mod blockstore; pub mod kvstore; -pub mod private_forest; \ No newline at end of file +pub mod private_forest; diff --git a/src/private_forest.rs b/src/private_forest.rs index 5686e19..feb7347 100644 --- a/src/private_forest.rs +++ b/src/private_forest.rs @@ -8,10 +8,7 @@ use rand::{rngs::ThreadRng, thread_rng}; use rand_chacha::ChaCha12Rng; use rand_core::SeedableRng; use rsa::{traits::PublicKeyParts, BigUint, Oaep, RsaPrivateKey, RsaPublicKey}; -use std::{ - rc::Rc, - sync::Mutex, -}; +use std::{rc::Rc, sync::Mutex}; use wnfs::{ common::{BlockStore, Metadata, CODEC_RAW}, @@ -409,8 +406,9 @@ impl<'a> PrivateDirectoryHelper<'a> { let root_dir = &mut self.root_dir; let mut modification_time_utc: DateTime = Utc::now(); if modification_time_seconds > 0 { - let naive_datetime = - DateTime::from_timestamp(modification_time_seconds, 0).unwrap().naive_utc(); + let naive_datetime = DateTime::from_timestamp(modification_time_seconds, 0) + .unwrap() + .naive_utc(); modification_time_utc = DateTime::from_naive_utc_and_offset(naive_datetime, Utc); } let write_res = root_dir @@ -714,7 +712,7 @@ impl<'a> PrivateDirectoryHelper<'a> { .enable_time() // Enable time-based features if needed .build() .expect("Unable to create a runtime"); - + runtime.block_on(PrivateDirectoryHelper::init(store, wnfs_key)) } @@ -874,4 +872,4 @@ impl ExchangeKey for PublicExchangeKey { } #[cfg(test)] -mod private_forest_tests; \ No newline at end of file +mod private_forest_tests; diff --git a/src/private_forest/private_forest_tests.rs b/src/private_forest/private_forest_tests.rs index b2c6475..6f98d36 100644 --- a/src/private_forest/private_forest_tests.rs +++ b/src/private_forest/private_forest_tests.rs @@ -124,7 +124,6 @@ async fn test_stream() { let mut file = File::create(filename).unwrap(); file.write_all(&vec![0u8; file_size]).unwrap(); - let read_res = helper .read_filestream_to_path(&read_filename.to_string(), &path_segments, 0) .await; @@ -237,7 +236,6 @@ async fn test_large_file_write_stream() { let path_buf: PathBuf = tmp_file.path().to_path_buf(); let path_string: String = path_buf.to_string_lossy().into_owned(); - let ls_result = helper.ls_files(&["root".into()]).await.unwrap(); println!("ls: {:?}", ls_result); assert!(ls_result.get(0).unwrap().0.contains("file_stream1.bin")); @@ -250,7 +248,6 @@ async fn test_large_file_write_stream() { let path_buf: PathBuf = tmp_file.path().to_path_buf(); let path_string: String = path_buf.to_string_lossy().into_owned(); - let ls_result = helper.ls_files(&["root".into()]).await.unwrap(); println!("ls: {:?}", ls_result); assert!(ls_result.iter().any(|item| item.0 == "file_stream2.bin")); @@ -441,7 +438,6 @@ fn synced_test_large_file_write_stream() { let path_buf: PathBuf = tmp_file.path().to_path_buf(); let path_string: String = path_buf.to_string_lossy().into_owned(); - let ls_result = helper.synced_ls_files(&["root".into()]).unwrap(); println!("ls: {:?}", ls_result); assert!(ls_result @@ -661,7 +657,6 @@ fn synced_test_large_file_write_stream_with_reload() { async_std::task::block_on(async { async_std::fs::write(tmp_file.path(), &data).await.unwrap(); }); - } let reload_helper = &mut PrivateDirectoryHelper::synced_reload(blockstore, cid).unwrap(); @@ -920,7 +915,6 @@ async fn test_large_file_write_stream_with_reload() { let path_buf: PathBuf = tmp_file.path().to_path_buf(); let path_string: String = path_buf.to_string_lossy().into_owned(); - let reload_helper = &mut PrivateDirectoryHelper::load_with_wnfs_key(blockstore, cid, empty_key.to_owned()) .await