refactor: segment external storage api boundaries (#3903)

This commit is contained in:
Zhengchao An
2026-06-26 15:10:49 +08:00
committed by GitHub
parent 738b805ec0
commit 1f7e159388
41 changed files with 269 additions and 48 deletions
+2 -2
View File
@@ -563,13 +563,13 @@ mod tests {
async fn format_disk(&self, _endpoint: &Endpoint) -> crate::Result<()> {
Ok(())
}
async fn get_bucket_info(&self, _bucket: &str) -> crate::Result<Option<crate::heal::storage_api::BucketInfo>> {
async fn get_bucket_info(&self, _bucket: &str) -> crate::Result<Option<crate::heal::storage_api::status::BucketInfo>> {
Ok(None)
}
async fn heal_bucket_metadata(&self, _bucket: &str) -> crate::Result<()> {
Ok(())
}
async fn list_buckets(&self) -> crate::Result<Vec<crate::heal::storage_api::BucketInfo>> {
async fn list_buckets(&self) -> crate::Result<Vec<crate::heal::storage_api::status::BucketInfo>> {
Ok(vec![])
}
async fn object_exists(&self, _bucket: &str, _object: &str) -> crate::Result<bool> {
+1 -1
View File
@@ -2408,7 +2408,7 @@ mod tests {
use rustfs_common::heal_channel::{HealOpts, HealRequestSource};
use rustfs_madmin::heal_commands::HealResultItem;
use super::super::{DiskStore, Endpoint, storage_api::BucketInfo};
use super::super::{DiskStore, Endpoint, storage_api::status::BucketInfo};
struct MockStorage;
+2 -2
View File
@@ -23,13 +23,13 @@ pub(crate) mod storage_api;
pub mod task;
pub mod utils;
use storage_api::{
use storage_api::owner::{
ECSTORE_BUCKET_META_PREFIX, ECSTORE_DATA_USAGE_CACHE_NAME, ECSTORE_GLOBAL_LOCAL_DISK_MAP, ECSTORE_RUSTFS_META_BUCKET,
EcstoreDeleteOptions, EcstoreDiskAPI, EcstoreDiskBytes, EcstoreDiskError, EcstoreDiskResult, EcstoreDiskStore,
EcstoreEndpoint, EcstoreErrorType, EcstoreStorageError, EcstoreStore, ObjectIO, ObjectOperations,
};
#[cfg(test)]
use storage_api::{EcstoreDiskOption, ecstore_new_disk};
use storage_api::owner::{EcstoreDiskOption, ecstore_new_disk};
pub use erasure_healer::ErasureSetHealer;
pub use manager::{HealManager, HealOperationsSnapshot, HealPriorityCounts, HealSourceCounts};
+1 -1
View File
@@ -19,7 +19,7 @@ use rustfs_madmin::heal_commands::HealResultItem;
use std::sync::Arc;
use tracing::{debug, error, warn};
use super::storage_api::{
use super::storage_api::storage::{
BucketInfo, BucketOperations, DiskSetSelector, HealOperations as _, ListOperations as _, ObjectIO as _,
ObjectOperations as _, StorageAdminApi,
};
+23
View File
@@ -27,3 +27,26 @@ pub(crate) use rustfs_ecstore::api::storage::ECStore as EcstoreStore;
pub(crate) use rustfs_storage_api::{
BucketInfo, BucketOperations, DiskSetSelector, HealOperations, ListOperations, ObjectIO, ObjectOperations, StorageAdminApi,
};
pub(crate) mod owner {
pub(crate) use super::{
ECSTORE_BUCKET_META_PREFIX, ECSTORE_DATA_USAGE_CACHE_NAME, ECSTORE_GLOBAL_LOCAL_DISK_MAP, ECSTORE_RUSTFS_META_BUCKET,
EcstoreDeleteOptions, EcstoreDiskAPI, EcstoreDiskBytes, EcstoreDiskError, EcstoreDiskResult, EcstoreDiskStore,
EcstoreEndpoint, EcstoreErrorType, EcstoreStorageError, EcstoreStore, ObjectIO, ObjectOperations,
};
#[cfg(test)]
pub(crate) use super::{EcstoreDiskOption, ecstore_new_disk};
}
pub(crate) mod storage {
pub(crate) use super::{
BucketInfo, BucketOperations, DiskSetSelector, HealOperations, ListOperations, ObjectIO, ObjectOperations,
StorageAdminApi,
};
}
#[cfg(test)]
pub(crate) mod status {
pub(crate) use super::BucketInfo;
}
+1 -1
View File
@@ -2208,7 +2208,7 @@ mod tests {
use std::collections::HashMap;
use std::sync::Mutex;
use super::super::storage_api::BucketInfo;
use super::super::storage_api::status::BucketInfo;
#[derive(Default)]
struct MockStorage {
listed: Mutex<bool>,
+1 -1
View File
@@ -21,7 +21,7 @@ use tokio_util::sync::CancellationToken;
#[path = "endpoint_index_test/storage_api.rs"]
mod storage_api;
use storage_api::{ECStore, Endpoint, EndpointServerPools, Endpoints, PoolEndpoints, init_local_disks};
use storage_api::endpoint_index::{ECStore, Endpoint, EndpointServerPools, Endpoints, PoolEndpoints, init_local_disks};
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn test_endpoint_index_settings() -> anyhow::Result<()> {
@@ -15,3 +15,7 @@
pub(crate) use rustfs_ecstore::api::disk::endpoint::Endpoint;
pub(crate) use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints};
pub(crate) use rustfs_ecstore::api::storage::{ECStore, init_local_disks};
pub(crate) mod endpoint_index {
pub(crate) use super::{ECStore, Endpoint, EndpointServerPools, Endpoints, PoolEndpoints, init_local_disks};
}
+1 -1
View File
@@ -21,7 +21,7 @@ use rustfs_heal::heal::{
#[path = "heal_bug_fixes_test/storage_api.rs"]
mod storage_api;
use storage_api::{BucketInfo, DiskStore, Endpoint};
use storage_api::bug_fixes::{BucketInfo, DiskStore, Endpoint};
#[test]
fn test_heal_event_to_heal_request_no_panic() {
@@ -14,3 +14,7 @@
pub(crate) use rustfs_ecstore::api::disk::{DiskStore, endpoint::Endpoint};
pub(crate) use rustfs_storage_api::BucketInfo;
pub(crate) mod bug_fixes {
pub(crate) use super::{BucketInfo, DiskStore, Endpoint};
}
+1 -1
View File
@@ -33,7 +33,7 @@ use walkdir::WalkDir;
#[path = "heal_integration_test/storage_api.rs"]
mod storage_api;
use storage_api::{
use storage_api::integration::{
BucketOperations, BucketOptions, ECStore, Endpoint, EndpointServerPools, Endpoints, ObjectIO as _, ObjectOperations as _,
PoolEndpoints, init_bucket_metadata_sys, init_local_disks,
};
@@ -17,3 +17,10 @@ pub(crate) use rustfs_ecstore::api::disk::endpoint::Endpoint;
pub(crate) use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints};
pub(crate) use rustfs_ecstore::api::storage::{ECStore, init_local_disks};
pub(crate) use rustfs_storage_api::{BucketOperations, BucketOptions, ObjectIO, ObjectOperations};
pub(crate) mod integration {
pub(crate) use super::{
BucketOperations, BucketOptions, ECStore, Endpoint, EndpointServerPools, Endpoints, ObjectIO, ObjectOperations,
PoolEndpoints, init_bucket_metadata_sys, init_local_disks,
};
}