refactor: narrow IAM and Swift compatibility surfaces (#3587)

* refactor: narrow IAM and Swift compatibility surfaces

* refactor: narrow heal and scanner compatibility surfaces (#3588)

* refactor: narrow RustFS runtime compatibility surfaces (#3591)
This commit is contained in:
安正超
2026-06-19 03:06:57 +08:00
committed by GitHub
parent 9b1272529a
commit b14e49e84e
15 changed files with 696 additions and 271 deletions
+10 -9
View File
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage_compat::IamStorageError;
use rustfs_policy::policy::Error as PolicyError;
pub type Result<T> = core::result::Result<T, Error>;
@@ -179,20 +180,20 @@ impl Error {
}
}
impl From<crate::storage_compat::ecstore::error::StorageError> for Error {
fn from(e: crate::storage_compat::ecstore::error::StorageError) -> Self {
impl From<IamStorageError> for Error {
fn from(e: IamStorageError) -> Self {
match e {
crate::storage_compat::ecstore::error::StorageError::ConfigNotFound => Error::ConfigNotFound,
IamStorageError::ConfigNotFound => Error::ConfigNotFound,
_ => Error::other(e),
}
}
}
impl From<Error> for crate::storage_compat::ecstore::error::StorageError {
impl From<Error> for IamStorageError {
fn from(e: Error) -> Self {
match e {
Error::ConfigNotFound => crate::storage_compat::ecstore::error::StorageError::ConfigNotFound,
_ => crate::storage_compat::ecstore::error::StorageError::other(e),
Error::ConfigNotFound => IamStorageError::ConfigNotFound,
_ => IamStorageError::other(e),
}
}
}
@@ -330,13 +331,13 @@ mod tests {
#[test]
fn test_iam_error_from_storage_error() {
// Test conversion from StorageError
let storage_error = crate::storage_compat::ecstore::error::StorageError::ConfigNotFound;
let storage_error = IamStorageError::ConfigNotFound;
let iam_error: Error = storage_error.into();
assert_eq!(iam_error, Error::ConfigNotFound);
// Test reverse conversion
let back_to_storage: crate::storage_compat::ecstore::error::StorageError = iam_error.into();
assert_eq!(back_to_storage, crate::storage_compat::ecstore::error::StorageError::ConfigNotFound);
let back_to_storage: IamStorageError = iam_error.into();
assert_eq!(back_to_storage, IamStorageError::ConfigNotFound);
}
#[test]