Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ where

let session = AsyncSession::mount(mountpoint, options).await?;


// release here
while let Some(req) = session.next_request().await? {
let fs = self.clone();
Expand Down
15 changes: 12 additions & 3 deletions src/pack.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::fungi::meta::{Ino, Inode};
use crate::fungi::{Error, Result, Writer};
use crate::store::{BlockStore, Store};
use crate::store::{BlockStore, Error as StoreError, Store};
use anyhow::Context;
use futures::lock::Mutex;
use std::collections::LinkedList;
Expand All @@ -19,7 +19,7 @@ type FailuresList = Arc<Mutex<Vec<(PathBuf, Error)>>>;
#[derive(Debug)]
struct Item(Ino, PathBuf, OsString, Metadata);
/// creates an FL from the given root location. It takes ownership of the writer because
/// it's logically incorrect to store multiple filessytem in the same FL.
/// it's logically incorrect to store multiple filesystem in the same FL.
/// All file chunks will then be uploaded to the provided store
///
pub async fn pack<P: Into<PathBuf>, S: Store>(
Expand Down Expand Up @@ -239,7 +239,16 @@ where
}

// write block to remote store
let block = self.store.set(&self.buffer[..size]).await?;
let store_result = self.store.set(&self.buffer[..size]).await;

if let Err(store_err) = &store_result {
if let StoreError::Other(_) = store_err {
log::error!("failed to upload file {}: {:#}", path.display(), store_err);
std::process::exit(1); // Force immediate termination
}
}

let block = store_result.map_err(Error::Store)?;

// write block info to meta
self.writer.block(ino, &block.id, &block.key).await?;
Expand Down
2 changes: 1 addition & 1 deletion src/server/block_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::server::{
config::AppState,
db::DB,
models::Block,
response::{BlockUploadedResponse, ResponseError, ResponseResult},
response::{ResponseError, ResponseResult},
};
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
Expand Down
Loading