mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-08 06:13:14 +00:00
@@ -1,5 +1,3 @@
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use crate::endpoints::EndpointServerPools;
|
||||
use crate::error::{Error, Result};
|
||||
use crate::global::get_global_endpoints;
|
||||
@@ -7,6 +5,8 @@ use crate::peer_rest_client::PeerRestClient;
|
||||
use crate::StorageAPI;
|
||||
use futures::future::join_all;
|
||||
use lazy_static::lazy_static;
|
||||
use madmin::{ItemState, ServerProperties};
|
||||
use std::sync::OnceLock;
|
||||
use tracing::error;
|
||||
|
||||
lazy_static! {
|
||||
@@ -95,6 +95,30 @@ impl NotificationSys {
|
||||
madmin::StorageInfo { disks, backend }
|
||||
}
|
||||
|
||||
pub async fn server_info(&self) -> Vec<ServerProperties> {
|
||||
let mut futures = Vec::with_capacity(self.peer_clients.len());
|
||||
|
||||
for client in self.peer_clients.iter() {
|
||||
futures.push(async move {
|
||||
if let Some(client) = client {
|
||||
match client.server_info().await {
|
||||
Ok(info) => info,
|
||||
Err(_) => ServerProperties {
|
||||
endpoint: client.host.to_string(),
|
||||
state: ItemState::Offline.to_string().to_owned(),
|
||||
disks: get_offline_disks(&client.host.to_string(), &get_global_endpoints()),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
} else {
|
||||
ServerProperties::default()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
join_all(futures).await
|
||||
}
|
||||
|
||||
pub async fn reload_pool_meta(&self) {
|
||||
let mut futures = Vec::with_capacity(self.peer_clients.len());
|
||||
for client in self.peer_clients.iter().flatten() {
|
||||
|
||||
Reference in New Issue
Block a user