mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 04:16:38 +00:00
refactor: centralize ecstore accessor runtime sources (#3813)
This commit is contained in:
@@ -168,11 +168,11 @@ impl ECStore {
|
||||
);
|
||||
let mut host = address.ip().to_string();
|
||||
if host.is_empty() {
|
||||
host = GLOBAL_RUSTFS_HOST.read().await.to_string()
|
||||
host = runtime_sources::rustfs_host().await
|
||||
}
|
||||
let mut port = address.port().to_string();
|
||||
if port.is_empty() {
|
||||
port = GLOBAL_RUSTFS_PORT.read().await.to_string()
|
||||
port = runtime_sources::rustfs_port().to_string()
|
||||
}
|
||||
debug!(
|
||||
event = EVENT_ECSTORE_INIT_STATUS,
|
||||
@@ -351,7 +351,7 @@ impl ECStore {
|
||||
break;
|
||||
}
|
||||
|
||||
set_object_layer(ec.clone()).await;
|
||||
runtime_sources::publish_object_store(ec.clone()).await;
|
||||
|
||||
if let Some(monitor) = runtime_sources::bucket_monitor() {
|
||||
let _ = ec.bucket_monitor.set(monitor);
|
||||
|
||||
@@ -113,7 +113,7 @@ pub fn init_lock_clients(endpoint_pools: EndpointServerPools) {
|
||||
|
||||
// Store the first LocalClient globally for use by other modules
|
||||
if !first_local_client_set {
|
||||
if let Err(e) = crate::global::set_global_lock_client(local_client.clone()) {
|
||||
if let Err(e) = runtime_sources::set_primary_lock_client(local_client.clone()) {
|
||||
// If already set, ignore the error (another thread may have set it)
|
||||
debug!(
|
||||
event = EVENT_LOCK_CLIENT_INITIALIZATION_FAILED,
|
||||
@@ -135,7 +135,7 @@ pub fn init_lock_clients(endpoint_pools: EndpointServerPools) {
|
||||
}
|
||||
|
||||
// Store the lock clients map globally
|
||||
if crate::global::set_global_lock_clients(clients).is_err() {
|
||||
if runtime_sources::set_lock_clients(clients).is_err() {
|
||||
error!(
|
||||
event = EVENT_LOCK_CLIENT_INITIALIZATION_FAILED,
|
||||
component = LOG_COMPONENT_ECSTORE,
|
||||
@@ -158,15 +158,15 @@ pub(super) async fn init_local_peer(endpoint_pools: &EndpointServerPools, host:
|
||||
|
||||
if peer_set.is_empty() {
|
||||
if !host.is_empty() {
|
||||
*GLOBAL_LOCAL_NODE_NAME.write().await = format!("{host}:{port}");
|
||||
runtime_sources::set_local_node_name(format!("{host}:{port}")).await;
|
||||
return;
|
||||
}
|
||||
|
||||
*GLOBAL_LOCAL_NODE_NAME.write().await = format!("127.0.0.1:{port}");
|
||||
runtime_sources::set_local_node_name(format!("127.0.0.1:{port}")).await;
|
||||
return;
|
||||
}
|
||||
|
||||
*GLOBAL_LOCAL_NODE_NAME.write().await = peer_set[0].clone();
|
||||
runtime_sources::set_local_node_name(peer_set[0].clone()).await;
|
||||
}
|
||||
|
||||
pub async fn get_disk_infos(disks: &[Option<DiskStore>]) -> Vec<Option<DiskInfo>> {
|
||||
|
||||
Reference in New Issue
Block a user