mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-07 13:53:12 +00:00
todo:Error
This commit is contained in:
@@ -1,14 +1,30 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use ecstore::store_api::ObjectOptions;
|
||||
use ecstore::store_api::PutObjReader;
|
||||
use ecstore::store_api::StorageAPI;
|
||||
use s3s::dto::*;
|
||||
use s3s::s3_error;
|
||||
use s3s::S3Error;
|
||||
use s3s::S3ErrorCode;
|
||||
use s3s::S3Result;
|
||||
use s3s::S3;
|
||||
use s3s::{S3Request, S3Response};
|
||||
|
||||
use anyhow::Result;
|
||||
use ecstore::store::ECStore;
|
||||
use tracing::error;
|
||||
|
||||
macro_rules! try_ {
|
||||
($result:expr) => {
|
||||
match $result {
|
||||
Ok(val) => val,
|
||||
Err(err) => {
|
||||
return Err(S3Error::with_message(S3ErrorCode::InternalError, format!("{}", err)));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FS {
|
||||
@@ -149,6 +165,12 @@ impl S3 for FS {
|
||||
|
||||
let Some(body) = body else { return Err(s3_error!(IncompleteBody)) };
|
||||
|
||||
let Some(content_length) = content_length else { return Err(s3_error!(IncompleteBody)) };
|
||||
|
||||
let reader = PutObjReader::new(body.into(), content_length as usize);
|
||||
|
||||
try_!(self.store.put_object(&bucket, &key, &reader, &ObjectOptions::default()).await);
|
||||
|
||||
// self.store.put_object(bucket, object, data, opts);
|
||||
|
||||
let output = PutObjectOutput { ..Default::default() };
|
||||
|
||||
Reference in New Issue
Block a user