mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-29 16:37:07 +00:00
refactor(replication): name the resync state error and keep io failures typed (#6628)
Backlog#1845 step 7. The replication crate's hand-rolled, crate-generic Error type actually describes one thing: failures of the persisted resync/MRF state files. Rename it to ResyncStateError so the name says so, and stop collapsing io::Error into Other(String): a new Io(std::io::Error) variant keeps the kind and source chain, Display renders identically, and the ecstore boundary maps it to StorageError::Io so the kind survives into store-layer classification instead of degrading into a stringified other(). No thiserror introduced - the crate keeps its zero-internal-deps posture and hand-written impls. Ref rustfs/backlog#1845
This commit is contained in:
@@ -53,10 +53,13 @@ pub(crate) const MRF_META_FORMAT: u16 = rustfs_replication::mrf::MRF_META_FORMAT
|
||||
)]
|
||||
pub(crate) const MRF_META_VERSION: u16 = rustfs_replication::mrf::MRF_META_VERSION;
|
||||
|
||||
fn map_replication_error(err: rustfs_replication::Error) -> Error {
|
||||
fn map_replication_error(err: rustfs_replication::ResyncStateError) -> Error {
|
||||
match err {
|
||||
rustfs_replication::Error::CorruptedFormat => Error::CorruptedFormat,
|
||||
rustfs_replication::Error::Other(err) => Error::other(err),
|
||||
rustfs_replication::ResyncStateError::CorruptedFormat => Error::CorruptedFormat,
|
||||
// Keep the io error typed so its kind survives into StorageError::Io
|
||||
// instead of degrading to a stringified other() (backlog#1845).
|
||||
rustfs_replication::ResyncStateError::Io(err) => Error::Io(err),
|
||||
rustfs_replication::ResyncStateError::Other(err) => Error::other(err),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user