From ad70ead5d40823e93f9592df37a5f4a30afcb788 Mon Sep 17 00:00:00 2001 From: Pasha Podolsky Date: Fri, 19 Jan 2024 12:48:24 +0300 Subject: [PATCH] [fix] Development --- src/config.rs | 1 + src/storages/fs_storage.rs | 7 +++++-- src/storages/mirroring.rs | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index 6246132..a827c0e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,6 +26,7 @@ pub struct FSShardConfig { pub weight: usize, } +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct S3ConfigCredentials { pub aws_access_key_id: String, pub aws_secret_access_key: String, diff --git a/src/storages/fs_storage.rs b/src/storages/fs_storage.rs index 9e10804..66e976d 100644 --- a/src/storages/fs_storage.rs +++ b/src/storages/fs_storage.rs @@ -83,12 +83,13 @@ impl FSStorageEngine { } Ok::<(), Error>(()) } - .instrument(info_span!("fs_sync", table_id = ?iroh_doc.id().to_string())) + .instrument(info_span!("fs_sync", table_id = iroh_doc.id().to_string())) }); for (_, fs_shard) in &fs_storage.fs_shards { tokio::spawn({ let fs_storage = fs_storage.clone(); let base_path = fs_shard.path().to_path_buf(); + info!("started"); async move { let mut read_dir_stream = tokio::fs::read_dir(&base_path) .await @@ -106,13 +107,15 @@ impl FSStorageEngine { .map_err(Error::doc)? .is_some(); if !exists_in_iroh { - info!(name: "event", "restore event: {:?}", entry.path()); + info!("importing: {:?}", entry.path()); let import_progress = fs_storage .iroh_doc() .import_file(fs_storage.author_id, key, &entry.path(), true) .await .map_err(Error::doc)?; import_progress.finish().await.map_err(Error::hash)?; + } else { + info!("skipping: {:?}", entry.path()); } } Ok::<(), Error>(()) diff --git a/src/storages/mirroring.rs b/src/storages/mirroring.rs index ccbb351..155a51c 100644 --- a/src/storages/mirroring.rs +++ b/src/storages/mirroring.rs @@ -22,6 +22,7 @@ impl Mirroring { sync_client: IrohClient, delete_after_mirroring: bool, ) -> Self { + let table_id = iroh_doc.id().to_string(); let thread = tokio::spawn( async move { let mut stream = iroh_doc.subscribe().await.unwrap(); @@ -93,7 +94,7 @@ impl Mirroring { warn!("stopped_mirroring"); Ok(()) } - .instrument(info_span!("mirroring", table_id = ?iroh_doc.id().to_string())), + .instrument(info_span!("mirroring", table_id = table_id)), ); Self { thread: Arc::new(thread),