Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Nov 24, 2024
1 parent 9f4b86a commit 599663d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ impl<'a> BlockStore for FFIFriendlyBlockStore<'a> {
//--------------------------------------------------------------------------------------------------

#[cfg(test)]
mod blockstore_tests;
mod blockstore_tests;
2 changes: 1 addition & 1 deletion src/kvstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ impl<'a> FFIStore<'a> for KVBlockStore {
bucket.set(&key, &value)?;
Ok(())
}
}
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod blockstore;
pub mod kvstore;
pub mod private_forest;
pub mod private_forest;
14 changes: 6 additions & 8 deletions src/private_forest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -409,8 +406,9 @@ impl<'a> PrivateDirectoryHelper<'a> {
let root_dir = &mut self.root_dir;
let mut modification_time_utc: DateTime<Utc> = 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
Expand Down Expand Up @@ -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))
}

Expand Down Expand Up @@ -874,4 +872,4 @@ impl ExchangeKey for PublicExchangeKey {
}

#[cfg(test)]
mod private_forest_tests;
mod private_forest_tests;
6 changes: 0 additions & 6 deletions src/private_forest/private_forest_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
Expand All @@ -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"));
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 599663d

Please sign in to comment.