refactor: route ecstore runtime globals through facade (#3941)

This commit is contained in:
Zhengchao An
2026-06-27 12:27:03 +08:00
committed by GitHub
parent d3f1ff36af
commit 1b3dea012e
14 changed files with 83 additions and 62 deletions
+7
View File
@@ -120,6 +120,13 @@ pub mod global {
};
}
pub mod runtime {
pub use crate::runtime::sources::{
bucket_monitor, first_cluster_node_is_local, global_tier_config_mgr, local_disk_map_read, object_store_handle,
setup_is_erasure, setup_is_erasure_sd,
};
}
pub mod layout {
pub use crate::layout::disks_layout::DisksLayout;
pub use crate::layout::endpoints::{EndpointServerPools, Endpoints, PoolEndpoints, SetupType};
+11 -7
View File
@@ -50,7 +50,7 @@ use rustfs_kms::{ObjectEncryptionService, get_global_encryption_service};
use rustfs_lock::client::LockClient;
use s3s::dto::BucketLifecycleConfiguration;
use s3s::region::Region;
use tokio::sync::RwLock;
use tokio::sync::{RwLock, RwLockReadGuard};
use tonic::transport::Channel;
use uuid::Uuid;
@@ -108,7 +108,7 @@ pub(crate) async fn object_encryption_service() -> Option<Arc<ObjectEncryptionSe
get_global_encryption_service().await
}
pub(crate) fn object_store_handle() -> Option<Arc<ECStore>> {
pub fn object_store_handle() -> Option<Arc<ECStore>> {
resolve_object_store_handle()
}
@@ -131,11 +131,11 @@ pub(crate) fn endpoint_pool_is_local(pool_index: usize) -> bool {
.is_some_and(|pool| pool.endpoints.as_ref().first().is_some_and(|endpoint| endpoint.is_local))
}
pub(crate) async fn first_cluster_node_is_local() -> bool {
pub async fn first_cluster_node_is_local() -> bool {
is_first_cluster_node_local().await
}
pub(crate) async fn setup_is_erasure() -> bool {
pub async fn setup_is_erasure() -> bool {
is_erasure().await
}
@@ -143,7 +143,7 @@ pub(crate) async fn setup_is_dist_erasure() -> bool {
is_dist_erasure().await
}
pub(crate) async fn setup_is_erasure_sd() -> bool {
pub async fn setup_is_erasure_sd() -> bool {
*GLOBAL_IsErasureSD.read().await
}
@@ -336,7 +336,7 @@ pub(crate) fn batch_processors() -> &'static GlobalBatchProcessors {
get_global_processors()
}
pub(crate) fn global_tier_config_mgr() -> Arc<RwLock<TierConfigMgr>> {
pub fn global_tier_config_mgr() -> Arc<RwLock<TierConfigMgr>> {
get_global_tier_config_mgr()
}
@@ -350,10 +350,14 @@ pub(crate) fn delete_bucket_monitor_entry(bucket: &str) {
}
}
pub(crate) fn bucket_monitor() -> Option<Arc<Monitor>> {
pub fn bucket_monitor() -> Option<Arc<Monitor>> {
get_global_bucket_monitor()
}
pub async fn local_disk_map_read() -> RwLockReadGuard<'static, HashMap<String, Option<DiskStore>>> {
GLOBAL_LOCAL_DISK_MAP.read().await
}
pub(crate) fn init_bucket_monitor_for_current_endpoints() {
let num_nodes = get_global_endpoints().get_nodes().len().try_into().unwrap_or(u64::MAX);
init_global_bucket_monitor(num_nodes);