Skip to content

Commit

Permalink
[fix] Development
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodolsky committed Jan 19, 2024
1 parent b088ce4 commit ad70ead
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions src/storages/fs_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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>(())
Expand Down
3 changes: 2 additions & 1 deletion src/storages/mirroring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit ad70ead

Please sign in to comment.