mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-28 16:07:05 +00:00
merge fix/224
This commit is contained in:
Generated
+4
-4
@@ -4050,9 +4050,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "numeric_cast"
|
name = "numeric_cast"
|
||||||
version = "0.2.2"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6699ec124a5322dd30184abe24b2b9a92237ed0fe8e038f1f410bf7cccfe8b33"
|
checksum = "a3c00a0c9600379bd32f8972de90676a7672cba3bf4886986bc05902afc1e093"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc"
|
name = "objc"
|
||||||
@@ -5574,7 +5574,7 @@ checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "s3s"
|
name = "s3s"
|
||||||
version = "0.11.0-dev"
|
version = "0.11.0-dev"
|
||||||
source = "git+https://github.com/Nugine/s3s.git?rev=529c8933a11528c506d5fbf7c4c2ab155db37dfe#529c8933a11528c506d5fbf7c4c2ab155db37dfe"
|
source = "git+https://github.com/Nugine/s3s.git?rev=7c78bd75f818783f1263041b61ab08b8182519b4#7c78bd75f818783f1263041b61ab08b8182519b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -5621,7 +5621,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "s3s-policy"
|
name = "s3s-policy"
|
||||||
version = "0.11.0-dev"
|
version = "0.11.0-dev"
|
||||||
source = "git+https://github.com/Nugine/s3s.git?rev=529c8933a11528c506d5fbf7c4c2ab155db37dfe#529c8933a11528c506d5fbf7c4c2ab155db37dfe"
|
source = "git+https://github.com/Nugine/s3s.git?rev=7c78bd75f818783f1263041b61ab08b8182519b4#7c78bd75f818783f1263041b61ab08b8182519b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.7.1",
|
"indexmap 2.7.1",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
+2
-2
@@ -71,10 +71,10 @@ reqwest = { version = "0.12.12", default-features = false, features = ["rustls-t
|
|||||||
rfd = { version = "0.15.2", default-features = false, features = ["xdg-portal", "tokio"] }
|
rfd = { version = "0.15.2", default-features = false, features = ["xdg-portal", "tokio"] }
|
||||||
rmp = "0.8.14"
|
rmp = "0.8.14"
|
||||||
rmp-serde = "1.3.0"
|
rmp-serde = "1.3.0"
|
||||||
s3s = { git = "https://github.com/Nugine/s3s.git", rev = "529c8933a11528c506d5fbf7c4c2ab155db37dfe", default-features = true, features = [
|
s3s = { git = "https://github.com/Nugine/s3s.git", rev = "7c78bd75f818783f1263041b61ab08b8182519b4", default-features = true, features = [
|
||||||
"tower",
|
"tower",
|
||||||
] }
|
] }
|
||||||
s3s-policy = { git = "https://github.com/Nugine/s3s.git", rev = "529c8933a11528c506d5fbf7c4c2ab155db37dfe" }
|
s3s-policy = { git = "https://github.com/Nugine/s3s.git", rev = "7c78bd75f818783f1263041b61ab08b8182519b4" }
|
||||||
shadow-rs = { version = "0.38.0", default-features = false }
|
shadow-rs = { version = "0.38.0", default-features = false }
|
||||||
serde = { version = "1.0.217", features = ["derive"] }
|
serde = { version = "1.0.217", features = ["derive"] }
|
||||||
serde_json = "1.0.138"
|
serde_json = "1.0.138"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use crate::disk::error::{
|
|||||||
use crate::disk::os::{check_path_length, is_empty_dir};
|
use crate::disk::os::{check_path_length, is_empty_dir};
|
||||||
use crate::disk::{LocalFileReader, LocalFileWriter, STORAGE_FORMAT_FILE};
|
use crate::disk::{LocalFileReader, LocalFileWriter, STORAGE_FORMAT_FILE};
|
||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use crate::file_meta::read_xl_meta_no_data;
|
use crate::file_meta::{get_file_info, read_xl_meta_no_data, FileInfoOpts};
|
||||||
use crate::global::{GLOBAL_IsErasureSD, GLOBAL_RootDiskThreshold};
|
use crate::global::{GLOBAL_IsErasureSD, GLOBAL_RootDiskThreshold};
|
||||||
use crate::heal::data_scanner::{has_active_rules, scan_data_folder, ScannerItem, ShouldSleepFn, SizeSummary};
|
use crate::heal::data_scanner::{has_active_rules, scan_data_folder, ScannerItem, ShouldSleepFn, SizeSummary};
|
||||||
use crate::heal::data_scanner_metric::{ScannerMetric, ScannerMetrics};
|
use crate::heal::data_scanner_metric::{ScannerMetric, ScannerMetrics};
|
||||||
@@ -1995,10 +1995,8 @@ impl DiskAPI for LocalDisk {
|
|||||||
|
|
||||||
let (data, _) = self.read_raw(volume, file_dir, file_path, read_data).await?;
|
let (data, _) = self.read_raw(volume, file_dir, file_path, read_data).await?;
|
||||||
|
|
||||||
let mut meta = FileMeta::default();
|
let fi = get_file_info(&data, volume, path, version_id, FileInfoOpts { data: read_data }).await?;
|
||||||
meta.unmarshal_msg(&data)?;
|
|
||||||
|
|
||||||
let fi = meta.into_fileinfo(volume, path, version_id, read_data, true)?;
|
|
||||||
Ok(fi)
|
Ok(fi)
|
||||||
}
|
}
|
||||||
async fn read_xl(&self, volume: &str, path: &str, read_data: bool) -> Result<RawFileInfo> {
|
async fn read_xl(&self, volume: &str, path: &str, read_data: bool) -> Result<RawFileInfo> {
|
||||||
|
|||||||
@@ -1208,8 +1208,9 @@ pub struct VolumeInfo {
|
|||||||
pub created: Option<OffsetDateTime>,
|
pub created: Option<OffsetDateTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug)]
|
#[derive(Deserialize, Serialize, Debug, Default)]
|
||||||
pub struct ReadOptions {
|
pub struct ReadOptions {
|
||||||
|
pub incl_free_versions: bool,
|
||||||
pub read_data: bool,
|
pub read_data: bool,
|
||||||
pub healing: bool,
|
pub healing: bool,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -554,7 +554,7 @@ impl FileMeta {
|
|||||||
let header = &ver.header;
|
let header = &ver.header;
|
||||||
|
|
||||||
if let Some(vid) = has_vid {
|
if let Some(vid) = has_vid {
|
||||||
if header.version_id == Some(vid) {
|
if header.version_id != Some(vid) {
|
||||||
is_latest = false;
|
is_latest = false;
|
||||||
succ_mod_time = header.mod_time;
|
succ_mod_time = header.mod_time;
|
||||||
continue;
|
continue;
|
||||||
@@ -2045,7 +2045,7 @@ pub struct FileInfoOpts {
|
|||||||
pub data: bool,
|
pub data: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_file_info(buf: &[u8], volume: &str, path: &str, version_id: &str, opts: FileInfoOpts) -> Result<FileInfo> {
|
pub async fn get_file_info(buf: &[u8], volume: &str, path: &str, version_id: &str, opts: FileInfoOpts) -> Result<FileInfo> {
|
||||||
let vid = {
|
let vid = {
|
||||||
if version_id.is_empty() {
|
if version_id.is_empty() {
|
||||||
None
|
None
|
||||||
@@ -2067,8 +2067,9 @@ async fn get_file_info(buf: &[u8], volume: &str, path: &str, version_id: &str, o
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warn!("get_file_info vid {:?}", &vid);
|
||||||
let fi = meta.into_fileinfo(volume, path, version_id, opts.data, true)?;
|
let fi = meta.into_fileinfo(volume, path, version_id, opts.data, true)?;
|
||||||
|
warn!("get_file_info {:?}", &fi);
|
||||||
Ok(fi)
|
Ok(fi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1088,7 +1088,11 @@ impl SetDisks {
|
|||||||
let mut errors = Vec::with_capacity(disks.len());
|
let mut errors = Vec::with_capacity(disks.len());
|
||||||
|
|
||||||
for disk in disks.iter() {
|
for disk in disks.iter() {
|
||||||
let opts = ReadOptions { read_data, healing };
|
let opts = ReadOptions {
|
||||||
|
read_data,
|
||||||
|
healing,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
futures.push(async move {
|
futures.push(async move {
|
||||||
if let Some(disk) = disk {
|
if let Some(disk) = disk {
|
||||||
if version_id.is_empty() {
|
if version_id.is_empty() {
|
||||||
@@ -3634,7 +3638,7 @@ impl ObjectIO for SetDisks {
|
|||||||
Ok(reader)
|
Ok(reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(level = "debug", skip(self, data))]
|
#[tracing::instrument(level = "debug", skip(self, data,))]
|
||||||
async fn put_object(&self, bucket: &str, object: &str, data: &mut PutObjReader, opts: &ObjectOptions) -> Result<ObjectInfo> {
|
async fn put_object(&self, bucket: &str, object: &str, data: &mut PutObjReader, opts: &ObjectOptions) -> Result<ObjectInfo> {
|
||||||
let disks = self.disks.read().await;
|
let disks = self.disks.read().await;
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ use s3s::S3;
|
|||||||
use s3s::{S3Request, S3Response};
|
use s3s::{S3Request, S3Response};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
use tracing::debug;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
use transform_stream::AsyncTryStream;
|
use transform_stream::AsyncTryStream;
|
||||||
@@ -751,6 +752,7 @@ impl S3 for FS {
|
|||||||
content_length,
|
content_length,
|
||||||
tagging,
|
tagging,
|
||||||
metadata,
|
metadata,
|
||||||
|
version_id,
|
||||||
..
|
..
|
||||||
} = input;
|
} = input;
|
||||||
|
|
||||||
@@ -784,10 +786,12 @@ impl S3 for FS {
|
|||||||
metadata.insert(xhttp::AMZ_OBJECT_TAGGING.to_owned(), tags);
|
metadata.insert(xhttp::AMZ_OBJECT_TAGGING.to_owned(), tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
let opts: ObjectOptions = put_opts(&bucket, &key, None, &req.headers, Some(metadata))
|
let opts: ObjectOptions = put_opts(&bucket, &key, version_id, &req.headers, Some(metadata))
|
||||||
.await
|
.await
|
||||||
.map_err(to_s3_error)?;
|
.map_err(to_s3_error)?;
|
||||||
|
|
||||||
|
debug!("put_object opts {:?}", &opts);
|
||||||
|
|
||||||
let obj_info = store
|
let obj_info = store
|
||||||
.put_object(&bucket, &key, &mut reader, &opts)
|
.put_object(&bucket, &key, &mut reader, &opts)
|
||||||
.await
|
.await
|
||||||
@@ -810,7 +814,11 @@ impl S3 for FS {
|
|||||||
req: S3Request<CreateMultipartUploadInput>,
|
req: S3Request<CreateMultipartUploadInput>,
|
||||||
) -> S3Result<S3Response<CreateMultipartUploadOutput>> {
|
) -> S3Result<S3Response<CreateMultipartUploadOutput>> {
|
||||||
let CreateMultipartUploadInput {
|
let CreateMultipartUploadInput {
|
||||||
bucket, key, tagging, ..
|
bucket,
|
||||||
|
key,
|
||||||
|
tagging,
|
||||||
|
version_id,
|
||||||
|
..
|
||||||
} = req.input;
|
} = req.input;
|
||||||
|
|
||||||
// mc cp step 3
|
// mc cp step 3
|
||||||
@@ -827,7 +835,7 @@ impl S3 for FS {
|
|||||||
metadata.insert(xhttp::AMZ_OBJECT_TAGGING.to_owned(), tags);
|
metadata.insert(xhttp::AMZ_OBJECT_TAGGING.to_owned(), tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
let opts: ObjectOptions = put_opts(&bucket, &key, None, &req.headers, Some(metadata))
|
let opts: ObjectOptions = put_opts(&bucket, &key, version_id, &req.headers, Some(metadata))
|
||||||
.await
|
.await
|
||||||
.map_err(to_s3_error)?;
|
.map_err(to_s3_error)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user