From a920204f3eadeceadb117756bff376322a70bcf4 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 23 Sep 2024 14:32:48 +0800 Subject: [PATCH] test rename_data --- ecstore/src/disk/local.rs | 11 +++++++++++ ecstore/src/disk/mod.rs | 12 ++++++++++++ ecstore/src/erasure.rs | 4 ++-- ecstore/src/quorum.rs | 14 ++++++++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index ebcc1267a..90b6e15c1 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -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 { + unimplemented!() + } async fn delete_versions( &self, volume: &str, diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 717014676..02c064b64 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -79,6 +79,14 @@ pub trait DiskAPI: Debug + Send + Sync + 'static { opts: &ReadOptions, ) -> Result; async fn read_xl(&self, volume: &str, path: &str, read_data: bool) -> Result; + async fn delete_version( + &self, + volume: &str, + path: &str, + fi: FileInfo, + force_del_marker: bool, + opts: DeleteOptions, + ) -> Result; 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, + pub sign: Option>, } #[derive(Debug, Clone, Default)] pub struct DeleteOptions { pub recursive: bool, pub immediate: bool, + pub undo_write: bool, + pub old_data_dir: Option, } #[derive(Debug, Clone)] diff --git a/ecstore/src/erasure.rs b/ecstore/src/erasure.rs index 82a5ec3d0..ae88ca8c3 100644 --- a/ecstore/src/erasure.rs +++ b/ecstore/src/erasure.rs @@ -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); diff --git a/ecstore/src/quorum.rs b/ecstore/src/quorum.rs index 1fd80b36d..aabfb7994 100644 --- a/ecstore/src/quorum.rs +++ b/ecstore/src/quorum.rs @@ -27,8 +27,16 @@ pub fn base_ignored_errs() -> Vec> { ] } -pub fn object_ignored_errs() -> Vec> { - vec![Box::new(DiskError::FileNotFound)] +// object_op_ignored_errs +pub fn object_op_ignored_errs() -> Vec> { + 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>, ignored_errs: &Vec>, ignored_errs: &Vec>, @@ -105,6 +114,7 @@ pub fn reduce_read_quorum_errs( } // 根据写quorum验证错误数量 +// 返回最大错误数量的下标,或QuorumError pub fn reduce_write_quorum_errs( errs: &Vec>, ignored_errs: &Vec>,