mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-05 21:07:43 +00:00
@@ -167,6 +167,47 @@ impl DiskError {
|
||||
}
|
||||
}
|
||||
|
||||
impl DiskError {
|
||||
pub fn to_u8(&self) -> u32 {
|
||||
match self {
|
||||
DiskError::MaxVersionsExceeded => 0x01,
|
||||
DiskError::Unexpected => 0x02,
|
||||
DiskError::CorruptedFormat => 0x03,
|
||||
DiskError::CorruptedBackend => 0x04,
|
||||
DiskError::UnformattedDisk => 0x05,
|
||||
DiskError::InconsistentDisk => 0x06,
|
||||
DiskError::UnsupportedDisk => 0x07,
|
||||
DiskError::DiskFull => 0x08,
|
||||
DiskError::DiskNotDir => 0x09,
|
||||
DiskError::DiskNotFound => 0x0A,
|
||||
DiskError::DiskOngoingReq => 0x0B,
|
||||
DiskError::DriveIsRoot => 0x0C,
|
||||
DiskError::FaultyRemoteDisk => 0x0D,
|
||||
DiskError::FaultyDisk => 0x0E,
|
||||
DiskError::DiskAccessDenied => 0x0F,
|
||||
DiskError::FileNotFound => 0x10,
|
||||
DiskError::FileVersionNotFound => 0x11,
|
||||
DiskError::TooManyOpenFiles => 0x12,
|
||||
DiskError::FileNameTooLong => 0x13,
|
||||
DiskError::VolumeExists => 0x14,
|
||||
DiskError::IsNotRegular => 0x15,
|
||||
DiskError::PathNotFound => 0x16,
|
||||
DiskError::VolumeNotFound => 0x17,
|
||||
DiskError::VolumeNotEmpty => 0x18,
|
||||
DiskError::VolumeAccessDenied => 0x19,
|
||||
DiskError::FileAccessDenied => 0x1A,
|
||||
DiskError::FileCorrupt => 0x1B,
|
||||
DiskError::BitrotHashAlgoInvalid => 0x1C,
|
||||
DiskError::CrossDeviceLink => 0x1D,
|
||||
DiskError::LessData => 0x1E,
|
||||
DiskError::MoreData => 0x1F,
|
||||
DiskError::OutdatedXLMeta => 0x20,
|
||||
DiskError::PartMissingOrCorrupt => 0x21,
|
||||
DiskError::NoHealRequired => 0x22,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for DiskError {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
core::mem::discriminant(self) == core::mem::discriminant(other)
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
use crate::bucket::error::BucketMetadataError;
|
||||
use crate::config::error::ConfigError;
|
||||
use crate::disk::error::DiskError;
|
||||
use crate::error::Error;
|
||||
use crate::quorum::QuorumError;
|
||||
use crate::store_err::StorageError;
|
||||
use crate::store_init::ErasureError;
|
||||
|
||||
pub mod bool_flag;
|
||||
pub mod crypto;
|
||||
pub mod ellipses;
|
||||
@@ -8,3 +16,21 @@ pub mod os;
|
||||
pub mod path;
|
||||
pub mod wildcard;
|
||||
pub mod xml;
|
||||
|
||||
const DISK_ERROR_MASK: u32 = 0x00001000;
|
||||
const STORAGE_ERROR_MASK: u8 = 0x20;
|
||||
const BUCKET_METADATA_ERROR_MASK: u8 = 0x30;
|
||||
const CONFIG_ERROR_MASK: u8 = 0x40;
|
||||
const QUORUM_ERROR_MASK: u8 = 0x50;
|
||||
const ERASURE_ERROR_MASK: u8 = 0x60;
|
||||
// error to u8
|
||||
pub fn error_to_u8(err: &Error) -> u8 {
|
||||
if let Some(e) = err.downcast_ref::<DiskError>() {
|
||||
} else if let Some(e) = err.downcast_ref::<StorageError>() {
|
||||
} else if let Some(e) = err.downcast_ref::<BucketMetadataError>() {
|
||||
} else if let Some(e) = err.downcast_ref::<ConfigError>() {
|
||||
} else if let Some(e) = err.downcast_ref::<QuorumError>() {
|
||||
} else if let Some(e) = err.downcast_ref::<ErasureError>() {
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user