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>,