refactor: use relative root compat paths (#3721)

This commit is contained in:
安正超
2026-06-22 12:02:37 +08:00
committed by GitHub
parent 30fa7e2ad4
commit 2dcc32db5a
22 changed files with 125 additions and 65 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::error_storage_compat::{QuotaError, StorageError};
use super::error_storage_compat::{QuotaError, StorageError};
use rustfs_storage_api::HTTPRangeError;
use s3s::{S3Error, S3ErrorCode};
+1 -1
View File
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use super::startup_storage_compat::{get_global_region, get_notification_config};
use crate::server::ShutdownHandle;
use crate::startup_storage_compat::{get_global_region, get_notification_config};
use crate::storage::{process_lambda_configurations, process_queue_configurations, process_topic_configurations};
use crate::{admin, config, version};
use rustfs_config::{
+2 -2
View File
@@ -18,7 +18,7 @@ use rustfs_storage_api::{
UserspaceProfilingCapability,
};
use crate::runtime_capabilities_storage_compat::{EndpointServerPools, topology_snapshot_from_endpoint_pools_with_capabilities};
use super::runtime_capabilities_storage_compat::{EndpointServerPools, topology_snapshot_from_endpoint_pools_with_capabilities};
const NOT_WIRED_INTO_RUNTIME: &str = "not wired into runtime";
const STORAGE_MEDIA_NOT_REPORTED: &str = "storage media not reported by endpoints";
@@ -131,8 +131,8 @@ fn cgroup_memory_status() -> CapabilityStatus {
#[cfg(test)]
mod tests {
use super::super::runtime_capabilities_storage_compat::{Endpoint, Endpoints, PoolEndpoints};
use super::*;
use crate::runtime_capabilities_storage_compat::{Endpoint, Endpoints, PoolEndpoints};
use rustfs_storage_api::{CapabilityState, ObservabilitySnapshotProvider, TopologySnapshotProvider};
#[tokio::test]
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::startup_storage_compat::ECStore;
use super::startup_storage_compat::ECStore;
use rustfs_heal::{create_ahm_services_cancel_token, heal::storage::ECStoreHealStorage, init_heal_manager};
use rustfs_utils::get_env_bool_with_aliases;
use std::{io::Result, sync::Arc};
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::startup_storage_compat::{
use super::startup_storage_compat::{
ECStore, get_global_replication_pool, init_bucket_metadata_sys, try_migrate_bucket_metadata, try_migrate_iam_config,
};
use rustfs_storage_api::{BucketOperations, BucketOptions};
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::startup_storage_compat::EndpointServerPools;
use super::startup_storage_compat::EndpointServerPools;
use rustfs_config::{
DEFAULT_RUSTFS_UNSUPPORTED_FS_POLICY, ENV_RUSTFS_UNSUPPORTED_FS_POLICY, RUSTFS_UNSUPPORTED_FS_POLICY_FAIL,
RUSTFS_UNSUPPORTED_FS_POLICY_WARN,
+1 -1
View File
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use super::startup_storage_compat::ECStore;
use crate::app::context::AppContext;
use crate::server::{ServiceStateManager, publish_ready_when_runtime_ready};
use crate::startup_storage_compat::ECStore;
use rustfs_common::{GlobalReadiness, SystemStage};
use rustfs_iam::init_iam_sys;
use rustfs_kms::KmsServiceManager;
+2 -2
View File
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use super::startup_storage_compat::{EcstoreResult, EndpointServerPools, new_global_notification_sys};
use crate::init::add_bucket_notification_configuration;
use crate::startup_storage_compat::{EcstoreResult, EndpointServerPools, new_global_notification_sys};
use std::{
future::Future,
io::{Error, Result},
@@ -80,7 +80,7 @@ mod tests {
#[tokio::test]
async fn notification_system_returns_source_error() {
let result =
init_notification_system_with(|| async { Err(crate::startup_storage_compat::EcstoreError::FaultyDisk) }).await;
init_notification_system_with(|| async { Err(super::super::startup_storage_compat::EcstoreError::FaultyDisk) }).await;
assert!(result.is_err());
}
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::startup_storage_compat::{set_global_region, set_global_rustfs_port};
use super::startup_storage_compat::{set_global_region, set_global_rustfs_port};
use crate::{
capacity::capacity_integration::init_capacity_management,
config::Config,
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::startup_storage_compat::{ECStore, EndpointServerPools};
use super::startup_storage_compat::{ECStore, EndpointServerPools};
use crate::{
config::Config,
init::{init_buffer_profile_system, init_kms_system},
+2 -2
View File
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::startup_fs_guard::enforce_unsupported_fs_policy;
use crate::startup_storage_compat::{
use super::startup_storage_compat::{
ECStore, EndpointServerPools, init_background_replication, init_ecstore_config, init_global_config_sys, init_local_disks,
init_lock_clients, prewarm_local_disk_id_map, set_global_endpoints, try_migrate_server_config, update_erasure_type,
};
use crate::startup_fs_guard::enforce_unsupported_fs_policy;
use rustfs_common::{GlobalReadiness, SystemStage};
use std::{
io::{Error, Result},
+6 -6
View File
@@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use super::core_storage_compat::ECStore;
use super::core_storage_compat::resolve_object_store_handle;
use super::core_storage_compat::{
PolicySys, StorageError, get_bucket_metadata, get_bucket_policy_raw, get_public_access_block_config, is_err_bucket_not_found,
};
use super::ecfs::FS;
use crate::auth::{check_key_valid, get_condition_values_with_query_and_client_info, get_session_token};
use crate::error::ApiError;
use crate::license::license_check;
use crate::server::RemoteAddr;
use crate::storage::core_storage_compat::ECStore;
use crate::storage::core_storage_compat::resolve_object_store_handle;
use crate::storage::core_storage_compat::{
PolicySys, StorageError, get_bucket_metadata, get_bucket_policy_raw, get_public_access_block_config, is_err_bucket_not_found,
};
use crate::storage::request_context::RequestContext;
use metrics::counter;
use rustfs_iam::error::Error as IamError;
@@ -930,7 +930,7 @@ impl S3Access for FS {
let req_info = ReqInfo {
cred,
is_owner,
region: crate::storage::core_storage_compat::get_global_region(),
region: super::core_storage_compat::get_global_region(),
request_context,
..Default::default()
};
+8 -8
View File
@@ -12,13 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::app::bucket_usecase::DefaultBucketUsecase;
use crate::app::context::resolve_object_store_handle;
use crate::app::multipart_usecase::DefaultMultipartUsecase;
use crate::app::object_usecase::DefaultObjectUsecase;
use crate::error::ApiError;
use crate::storage::access::has_bypass_governance_header;
use crate::storage::core_storage_compat::{
use super::core_storage_compat::{
BUCKET_ACCELERATE_CONFIG, BUCKET_LOGGING_CONFIG, BUCKET_REQUEST_PAYMENT_CONFIG, BUCKET_VERSIONING_CONFIG,
BUCKET_WEBSITE_CONFIG, BucketVersioningSys, OBJECT_LOCK_CONFIG, StorageError, check_retention_for_modification, decode_tags,
decode_tags_to_map, delete_bucket_metadata_config, encode_tags, get_bucket_accelerate_config, get_bucket_logging_config,
@@ -26,7 +20,13 @@ use crate::storage::core_storage_compat::{
is_err_bucket_not_found, is_err_object_not_found, is_err_version_not_found, record_replication_proxy, serialize,
update_bucket_metadata_config,
};
use crate::storage::core_storage_compat::{StorageReplicationConfigExt as _, StorageVersioningConfigExt as _};
use super::core_storage_compat::{StorageReplicationConfigExt as _, StorageVersioningConfigExt as _};
use crate::app::bucket_usecase::DefaultBucketUsecase;
use crate::app::context::resolve_object_store_handle;
use crate::app::multipart_usecase::DefaultMultipartUsecase;
use crate::app::object_usecase::DefaultObjectUsecase;
use crate::error::ApiError;
use crate::storage::access::has_bypass_governance_header;
use crate::storage::helper::OperationHelper;
use crate::storage::options::get_opts;
use crate::storage::s3_api::acl;
+6 -6
View File
@@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::config::{RustFSBufferConfig, WorkloadProfile, get_global_buffer_config, is_buffer_profile_enabled};
use crate::error::ApiError;
use crate::server::cors;
use crate::storage::core_storage_compat::StorageReplicationConfigExt as _;
use crate::storage::core_storage_compat::{
use super::core_storage_compat::StorageReplicationConfigExt as _;
use super::core_storage_compat::{
StorageError, add_object_lock_years, get_bucket_cors_config, get_bucket_object_lock_config, get_bucket_replication_config,
resolve_object_store_handle,
};
use crate::config::{RustFSBufferConfig, WorkloadProfile, get_global_buffer_config, is_buffer_profile_enabled};
use crate::error::ApiError;
use crate::server::cors;
use crate::storage::ecfs::ListObjectUnorderedQuery;
use http::header::{IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_UNMODIFIED_SINCE};
use http::{HeaderMap, HeaderValue, StatusCode};
@@ -738,7 +738,7 @@ pub(crate) async fn has_replication_rules(bucket: &str, objects: &[ObjectToDelet
}
/// Helper function to get store and validate bucket exists
pub(crate) async fn get_validated_store(bucket: &str) -> S3Result<Arc<crate::storage::core_storage_compat::ECStore>> {
pub(crate) async fn get_validated_store(bucket: &str) -> S3Result<Arc<super::core_storage_compat::ECStore>> {
let Some(store) = resolve_object_store_handle() else {
return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string()));
};
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::core_storage_compat::ECStore;
use super::core_storage_compat::ECStore;
use rustfs_storage_api::ListOperations as _;
use std::sync::Arc;
+4 -4
View File
@@ -30,11 +30,11 @@ pub mod timeout_wrapper;
pub mod tonic_service;
pub(crate) type StorageDeletedObject = rustfs_storage_api::DeletedObject;
pub(crate) type StorageGetObjectReader = crate::storage::core_storage_compat::GetObjectReader;
pub(crate) type StorageObjectInfo = crate::storage::core_storage_compat::ObjectInfo;
pub(crate) type StorageObjectOptions = crate::storage::core_storage_compat::ObjectOptions;
pub(crate) type StorageGetObjectReader = self::core_storage_compat::GetObjectReader;
pub(crate) type StorageObjectInfo = self::core_storage_compat::ObjectInfo;
pub(crate) type StorageObjectOptions = self::core_storage_compat::ObjectOptions;
pub(crate) type StorageObjectToDelete = rustfs_storage_api::ObjectToDelete;
pub(crate) type StoragePutObjReader = crate::storage::core_storage_compat::PutObjReader;
pub(crate) type StoragePutObjReader = self::core_storage_compat::PutObjReader;
#[cfg(test)]
mod concurrent_fix_test;
+3 -3
View File
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::core_storage_compat::BucketVersioningSys;
use crate::storage::core_storage_compat::Result;
use crate::storage::core_storage_compat::StorageError;
use super::core_storage_compat::BucketVersioningSys;
use super::core_storage_compat::Result;
use super::core_storage_compat::StorageError;
use http::header::{IF_MATCH, IF_NONE_MATCH};
use http::{HeaderMap, HeaderValue};
use rustfs_utils::http::{
+8 -8
View File
@@ -69,7 +69,7 @@
//! }
//! ```
use crate::storage::core_storage_compat::StorageError;
use super::core_storage_compat::StorageError;
#[cfg(feature = "rio-v2")]
use aes_gcm::aead::Payload;
use aes_gcm::{
@@ -133,9 +133,9 @@ const SEALED_KEY_SIZE: usize = DARE_HEADER_SIZE + 32 + DARE_TAG_SIZE;
#[cfg(feature = "rio-v2")]
const OBJECT_KEY_DERIVATION_CONTEXT: &[u8] = b"object-encryption-key generation";
use super::core_storage_compat::Error;
use super::core_storage_compat::get_bucket_sse_config;
use crate::error::ApiError;
use crate::storage::core_storage_compat::Error;
use crate::storage::core_storage_compat::get_bucket_sse_config;
use rustfs_utils::http::headers::{
AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM, AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY,
AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5, AMZ_SERVER_SIDE_ENCRYPTION_KMS_CONTEXT,
@@ -751,19 +751,19 @@ pub struct ManagedSealedKey {
}
impl EncryptionMaterial {
pub fn write_encryption(&self, multipart_part_number: Option<usize>) -> crate::storage::core_storage_compat::WriteEncryption {
pub fn write_encryption(&self, multipart_part_number: Option<usize>) -> super::core_storage_compat::WriteEncryption {
match (self.key_kind, multipart_part_number) {
(EncryptionKeyKind::Object, Some(part_number)) => {
crate::storage::core_storage_compat::WriteEncryption::multipart_object_key(self.key_bytes, part_number as u32)
super::core_storage_compat::WriteEncryption::multipart_object_key(self.key_bytes, part_number as u32)
}
(EncryptionKeyKind::Object, None) => {
crate::storage::core_storage_compat::WriteEncryption::singlepart_object_key(self.key_bytes)
super::core_storage_compat::WriteEncryption::singlepart_object_key(self.key_bytes)
}
(EncryptionKeyKind::Direct, Some(part_number)) => {
crate::storage::core_storage_compat::WriteEncryption::multipart(self.key_bytes, self.base_nonce, part_number)
super::core_storage_compat::WriteEncryption::multipart(self.key_bytes, self.base_nonce, part_number)
}
(EncryptionKeyKind::Direct, None) => {
crate::storage::core_storage_compat::WriteEncryption::singlepart(self.key_bytes, self.base_nonce)
super::core_storage_compat::WriteEncryption::singlepart(self.key_bytes, self.base_nonce)
}
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ use std::{
time::{Duration as StdDuration, Instant},
};
use crate::table_catalog_storage_compat::{
use super::table_catalog_storage_compat::{
BUCKET_TABLE_CATALOG_META_PREFIX, BUCKET_TABLE_CATALOG_TABLE_BUCKETS_PREFIX, BUCKET_TABLE_CONFIG,
BUCKET_TABLE_RESERVED_PREFIX, EcstoreError, RUSTFS_META_BUCKET, StorageError, get_bucket_metadata, get_lock_acquire_timeout,
table_catalog_path_hash,
+2 -2
View File
@@ -17,10 +17,10 @@ use rustfs_concurrency::{
WorkloadClass,
};
use crate::storage::concurrency::get_concurrency_manager;
use crate::workload_admission_storage_compat::{
use super::workload_admission_storage_compat::{
get_global_bucket_metadata_sys, get_global_replication_pool, replication_queue_current_count,
};
use crate::storage::concurrency::get_concurrency_manager;
const BUCKET_METADATA_RUNTIME_NOT_INITIALIZED: &str = "bucket metadata runtime not initialized";
const HEAL_MANAGER_NOT_INITIALIZED: &str = "heal manager not initialized";