mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 16:28:15 +00:00
test rename_data
This commit is contained in:
@@ -742,6 +742,7 @@ impl DiskAPI for LocalDisk {
|
||||
|
||||
Ok(RenameDataResp {
|
||||
old_data_dir: old_data_dir,
|
||||
sign: None, // TODO:
|
||||
})
|
||||
}
|
||||
|
||||
@@ -872,6 +873,16 @@ impl DiskAPI for LocalDisk {
|
||||
|
||||
Ok(RawFileInfo { buf })
|
||||
}
|
||||
async fn delete_version(
|
||||
&self,
|
||||
volume: &str,
|
||||
path: &str,
|
||||
fi: FileInfo,
|
||||
force_del_marker: bool,
|
||||
opts: DeleteOptions,
|
||||
) -> Result<RawFileInfo> {
|
||||
unimplemented!()
|
||||
}
|
||||
async fn delete_versions(
|
||||
&self,
|
||||
volume: &str,
|
||||
|
||||
@@ -79,6 +79,14 @@ pub trait DiskAPI: Debug + Send + Sync + 'static {
|
||||
opts: &ReadOptions,
|
||||
) -> Result<FileInfo>;
|
||||
async fn read_xl(&self, volume: &str, path: &str, read_data: bool) -> Result<RawFileInfo>;
|
||||
async fn delete_version(
|
||||
&self,
|
||||
volume: &str,
|
||||
path: &str,
|
||||
fi: FileInfo,
|
||||
force_del_marker: bool,
|
||||
opts: DeleteOptions,
|
||||
) -> Result<RawFileInfo>;
|
||||
async fn delete_versions(
|
||||
&self,
|
||||
volume: &str,
|
||||
@@ -206,14 +214,18 @@ pub struct DiskOption {
|
||||
pub health_check: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct RenameDataResp {
|
||||
pub old_data_dir: Option<Uuid>,
|
||||
pub sign: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct DeleteOptions {
|
||||
pub recursive: bool,
|
||||
pub immediate: bool,
|
||||
pub undo_write: bool,
|
||||
pub old_data_dir: Option<Uuid>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::error::{Error, Result, StdError};
|
||||
use crate::quorum::{object_ignored_errs, reduce_write_quorum_errs};
|
||||
use crate::quorum::{object_op_ignored_errs, reduce_write_quorum_errs};
|
||||
use bytes::Bytes;
|
||||
use futures::future::join_all;
|
||||
use futures::{Stream, StreamExt};
|
||||
@@ -94,7 +94,7 @@ impl Erasure {
|
||||
|
||||
warn!("Erasure encode errs {:?}", errs);
|
||||
|
||||
let err_idx = reduce_write_quorum_errs(&errs, object_ignored_errs().as_ref(), write_quorum)?;
|
||||
let err_idx = reduce_write_quorum_errs(&errs, object_op_ignored_errs().as_ref(), write_quorum)?;
|
||||
if errs[err_idx].is_some() {
|
||||
let err = errs[err_idx].take().unwrap();
|
||||
return Err(err);
|
||||
|
||||
+12
-2
@@ -27,8 +27,16 @@ pub fn base_ignored_errs() -> Vec<Box<dyn CheckErrorFn>> {
|
||||
]
|
||||
}
|
||||
|
||||
pub fn object_ignored_errs() -> Vec<Box<dyn CheckErrorFn>> {
|
||||
vec![Box::new(DiskError::FileNotFound)]
|
||||
// object_op_ignored_errs
|
||||
pub fn object_op_ignored_errs() -> Vec<Box<dyn CheckErrorFn>> {
|
||||
vec![
|
||||
Box::new(DiskError::DiskNotFound),
|
||||
Box::new(DiskError::FaultyDisk),
|
||||
Box::new(DiskError::FaultyRemoteDisk),
|
||||
Box::new(DiskError::DiskAccessDenied),
|
||||
Box::new(DiskError::UnformattedDisk),
|
||||
Box::new(DiskError::DiskOngoingReq),
|
||||
]
|
||||
}
|
||||
|
||||
// 用于检查错误是否被忽略的函数
|
||||
@@ -91,6 +99,7 @@ fn reduce_quorum_errs(errs: &Vec<Option<Error>>, ignored_errs: &Vec<Box<dyn Chec
|
||||
}
|
||||
|
||||
// 根据读quorum验证错误数量
|
||||
// 返回最大错误数量的下标,或QuorumError
|
||||
pub fn reduce_read_quorum_errs(
|
||||
errs: &mut Vec<Option<Error>>,
|
||||
ignored_errs: &Vec<Box<dyn CheckErrorFn>>,
|
||||
@@ -105,6 +114,7 @@ pub fn reduce_read_quorum_errs(
|
||||
}
|
||||
|
||||
// 根据写quorum验证错误数量
|
||||
// 返回最大错误数量的下标,或QuorumError
|
||||
pub fn reduce_write_quorum_errs(
|
||||
errs: &Vec<Option<Error>>,
|
||||
ignored_errs: &Vec<Box<dyn CheckErrorFn>>,
|
||||
|
||||
Reference in New Issue
Block a user