mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-24 13:16:28 +00:00
refactor: clean runtime and test storage boundaries (#3573)
* refactor: clean runtime observability select boundaries * refactor: clean test harness fuzz storage boundaries
This commit is contained in:
@@ -179,20 +179,20 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<rustfs_ecstore::error::StorageError> for Error {
|
||||
fn from(e: rustfs_ecstore::error::StorageError) -> Self {
|
||||
impl From<crate::storage_compat::ecstore::error::StorageError> for Error {
|
||||
fn from(e: crate::storage_compat::ecstore::error::StorageError) -> Self {
|
||||
match e {
|
||||
rustfs_ecstore::error::StorageError::ConfigNotFound => Error::ConfigNotFound,
|
||||
crate::storage_compat::ecstore::error::StorageError::ConfigNotFound => Error::ConfigNotFound,
|
||||
_ => Error::other(e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Error> for rustfs_ecstore::error::StorageError {
|
||||
impl From<Error> for crate::storage_compat::ecstore::error::StorageError {
|
||||
fn from(e: Error) -> Self {
|
||||
match e {
|
||||
Error::ConfigNotFound => rustfs_ecstore::error::StorageError::ConfigNotFound,
|
||||
_ => rustfs_ecstore::error::StorageError::other(e),
|
||||
Error::ConfigNotFound => crate::storage_compat::ecstore::error::StorageError::ConfigNotFound,
|
||||
_ => crate::storage_compat::ecstore::error::StorageError::other(e),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,13 +330,13 @@ mod tests {
|
||||
#[test]
|
||||
fn test_iam_error_from_storage_error() {
|
||||
// Test conversion from StorageError
|
||||
let storage_error = rustfs_ecstore::error::StorageError::ConfigNotFound;
|
||||
let storage_error = crate::storage_compat::ecstore::error::StorageError::ConfigNotFound;
|
||||
let iam_error: Error = storage_error.into();
|
||||
assert_eq!(iam_error, Error::ConfigNotFound);
|
||||
|
||||
// Test reverse conversion
|
||||
let back_to_storage: rustfs_ecstore::error::StorageError = iam_error.into();
|
||||
assert_eq!(back_to_storage, rustfs_ecstore::error::StorageError::ConfigNotFound);
|
||||
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);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
// limitations under the License.
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::storage_compat::ecstore::store::ECStore;
|
||||
use manager::IamCache;
|
||||
use oidc::OidcSys;
|
||||
use rustfs_ecstore::store::ECStore;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use store::object::ObjectStore;
|
||||
use sys::IamSys;
|
||||
@@ -33,6 +33,7 @@ pub mod keyring;
|
||||
pub mod manager;
|
||||
pub mod oidc;
|
||||
pub mod oidc_state;
|
||||
mod storage_compat;
|
||||
pub mod store;
|
||||
pub mod sys;
|
||||
pub mod utils;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use crate::error::{Error, Result, is_err_config_not_found};
|
||||
use crate::storage_compat::ecstore::global::is_first_cluster_node_local;
|
||||
use crate::sys::{get_claims_from_token_with_secret, get_claims_from_token_with_secret_allow_missing_exp};
|
||||
use crate::{
|
||||
cache::{Cache, CacheEntity, LockedCache},
|
||||
@@ -25,7 +26,6 @@ use crate::{
|
||||
};
|
||||
use futures::future::join_all;
|
||||
use rustfs_credentials::{Credentials, EMBEDDED_POLICY_TYPE, INHERITED_POLICY_TYPE, get_global_action_cred};
|
||||
use rustfs_ecstore::global::is_first_cluster_node_local;
|
||||
use rustfs_madmin::{AccountStatus, AddOrUpdateUserReq, GroupDesc};
|
||||
use rustfs_policy::{
|
||||
arn::ARN,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub(crate) use rustfs_ecstore as ecstore;
|
||||
@@ -14,6 +14,14 @@
|
||||
|
||||
use super::{GroupInfo, MappedPolicy, Store, UserType};
|
||||
use crate::error::{Error, Result, is_err_config_not_found, is_err_no_such_group};
|
||||
use crate::storage_compat::ecstore::error::{Error as EcstoreError, StorageError, classify_system_path_failure_reason};
|
||||
use crate::storage_compat::ecstore::{
|
||||
config::{
|
||||
RUSTFS_CONFIG_PREFIX,
|
||||
com::{delete_config, read_config_no_lock, read_config_with_metadata, save_config, save_config_with_opts},
|
||||
},
|
||||
store::ECStore,
|
||||
};
|
||||
use crate::{
|
||||
cache::{Cache, CacheEntity},
|
||||
error::{is_err_no_such_policy, is_err_no_such_user},
|
||||
@@ -22,14 +30,6 @@ use crate::{
|
||||
};
|
||||
use futures::future::join_all;
|
||||
use rustfs_credentials::get_global_action_cred;
|
||||
use rustfs_ecstore::error::{Error as EcstoreError, StorageError, classify_system_path_failure_reason};
|
||||
use rustfs_ecstore::{
|
||||
config::{
|
||||
RUSTFS_CONFIG_PREFIX,
|
||||
com::{delete_config, read_config_no_lock, read_config_with_metadata, save_config, save_config_with_opts},
|
||||
},
|
||||
store::ECStore,
|
||||
};
|
||||
use rustfs_io_metrics::record_system_path_failure;
|
||||
use rustfs_policy::{auth::UserIdentity, policy::PolicyDoc};
|
||||
use rustfs_storage_api::{HTTPPreconditions, ListOperations as _, ObjectInfoOrErr as StorageObjectInfoOrErr};
|
||||
@@ -589,7 +589,7 @@ impl ObjectStore {
|
||||
|
||||
match read_config_no_lock(self.object_api.clone(), &probe_path).await {
|
||||
Ok(_) => Ok(()),
|
||||
Err(rustfs_ecstore::error::StorageError::ConfigNotFound) => Err(Error::other(format!(
|
||||
Err(crate::storage_compat::ecstore::error::StorageError::ConfigNotFound) => Err(Error::other(format!(
|
||||
"Storage metadata not ready: probe object '{}' not found (expected IAM config to be initialized)",
|
||||
probe_path
|
||||
))),
|
||||
|
||||
@@ -19,13 +19,13 @@ use crate::error::{Error, Result};
|
||||
use crate::manager::extract_jwt_claims;
|
||||
use crate::manager::get_default_policyes;
|
||||
use crate::manager::{IamCache, IamSyncMetricsSnapshot};
|
||||
use crate::storage_compat::ecstore::notification_sys::get_global_notification_sys;
|
||||
use crate::store::GroupInfo;
|
||||
use crate::store::MappedPolicy;
|
||||
use crate::store::Store;
|
||||
use crate::store::UserType;
|
||||
use crate::utils::{extract_claims, extract_claims_allow_missing_exp};
|
||||
use rustfs_credentials::{Credentials, EMBEDDED_POLICY_TYPE, INHERITED_POLICY_TYPE, get_global_action_cred};
|
||||
use rustfs_ecstore::notification_sys::get_global_notification_sys;
|
||||
use rustfs_madmin::AddOrUpdateUserReq;
|
||||
use rustfs_madmin::GroupDesc;
|
||||
use rustfs_policy::arn::ARN;
|
||||
|
||||
Reference in New Issue
Block a user