refactor: centralize external ECStore facade aliases (#3746)

This commit is contained in:
Zhengchao An
2026-06-22 20:37:13 +08:00
committed by GitHub
parent 89805ffb4d
commit 88a87b3e8f
16 changed files with 222 additions and 118 deletions
+10 -6
View File
@@ -14,15 +14,19 @@
//! test endpoint index settings
use rustfs_ecstore::api::{
disk::endpoint::Endpoint,
layout::{EndpointServerPools, Endpoints, PoolEndpoints},
storage::{ECStore, init_local_disks},
};
use rustfs_ecstore::api::disk as ecstore_disk;
use rustfs_ecstore::api::layout as ecstore_layout;
use rustfs_ecstore::api::storage as ecstore_storage;
use std::net::SocketAddr;
use tempfile::TempDir;
use tokio_util::sync::CancellationToken;
type ECStore = ecstore_storage::ECStore;
type Endpoint = ecstore_disk::endpoint::Endpoint;
type EndpointServerPools = ecstore_layout::EndpointServerPools;
type Endpoints = ecstore_layout::Endpoints;
type PoolEndpoints = ecstore_layout::PoolEndpoints;
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn test_endpoint_index_settings() -> anyhow::Result<()> {
let temp_dir = TempDir::new()?;
@@ -74,7 +78,7 @@ async fn test_endpoint_index_settings() -> anyhow::Result<()> {
}
// test ECStore initialization
init_local_disks(endpoint_pools.clone()).await?;
ecstore_storage::init_local_disks(endpoint_pools.clone()).await?;
let server_addr: SocketAddr = "127.0.0.1:0".parse().unwrap();
let ecstore = ECStore::new(server_addr, endpoint_pools, CancellationToken::new()).await?;
+4 -1
View File
@@ -12,13 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use rustfs_ecstore::api::disk::{DiskStore, endpoint::Endpoint};
use rustfs_ecstore::api::disk as ecstore_disk;
use rustfs_heal::heal::{
event::{HealEvent, Severity},
task::{HealPriority, HealType},
utils,
};
type DiskStore = ecstore_disk::DiskStore;
type Endpoint = ecstore_disk::endpoint::Endpoint;
#[test]
fn test_heal_event_to_heal_request_no_panic() {
// Test that invalid pool/set indices don't cause panic
+12 -8
View File
@@ -14,12 +14,10 @@
use http::HeaderMap;
use rustfs_common::heal_channel::{HealOpts, HealScanMode};
use rustfs_ecstore::api::{
bucket::metadata_sys::init_bucket_metadata_sys,
disk::endpoint::Endpoint,
layout::{EndpointServerPools, Endpoints, PoolEndpoints},
storage::{ECStore, init_local_disks},
};
use rustfs_ecstore::api::bucket as ecstore_bucket;
use rustfs_ecstore::api::disk as ecstore_disk;
use rustfs_ecstore::api::layout as ecstore_layout;
use rustfs_ecstore::api::storage as ecstore_storage;
use rustfs_heal::heal::{
manager::{HealConfig, HealManager},
storage::{ECStoreHealStorage, HealObjectOptions as ObjectOptions, HealPutObjReader as PutObjReader, HealStorageAPI},
@@ -41,6 +39,12 @@ const HEAL_FORMAT_WAIT_TIMEOUT: Duration = Duration::from_secs(25);
const HEAL_FORMAT_WAIT_INTERVAL: Duration = Duration::from_millis(250);
const NON_INLINE_TEST_DATA_SIZE: usize = 256 * 1024 + 137;
type ECStore = ecstore_storage::ECStore;
type Endpoint = ecstore_disk::endpoint::Endpoint;
type EndpointServerPools = ecstore_layout::EndpointServerPools;
type Endpoints = ecstore_layout::Endpoints;
type PoolEndpoints = ecstore_layout::PoolEndpoints;
fn non_inline_test_data() -> Vec<u8> {
(0..NON_INLINE_TEST_DATA_SIZE).map(|idx| (idx % 251) as u8).collect()
}
@@ -123,7 +127,7 @@ async fn setup_test_env() -> (Vec<PathBuf>, Arc<ECStore>, Arc<ECStoreHealStorage
let endpoint_pools = EndpointServerPools::from(vec![pool_endpoints]);
// format disks (only first time)
init_local_disks(endpoint_pools.clone()).await.unwrap();
ecstore_storage::init_local_disks(endpoint_pools.clone()).await.unwrap();
// create ECStore with dynamic port 0 (let OS assign) or fixed 9001 if free
let port = 9001; // for simplicity
@@ -141,7 +145,7 @@ async fn setup_test_env() -> (Vec<PathBuf>, Arc<ECStore>, Arc<ECStoreHealStorage
.await
.unwrap();
let buckets = buckets_list.into_iter().map(|v| v.name).collect();
init_bucket_metadata_sys(ecstore.clone(), buckets).await;
ecstore_bucket::metadata_sys::init_bucket_metadata_sys(ecstore.clone(), buckets).await;
// Create heal storage layer
let heal_storage = Arc::new(ECStoreHealStorage::new(ecstore.clone()));