mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-28 07:57:01 +00:00
refactor: centralize ecstore owner runtime sources (#3811)
This commit is contained in:
@@ -15,10 +15,10 @@
|
||||
use crate::admin_server_info::get_commit_id;
|
||||
use crate::endpoints::EndpointServerPools;
|
||||
use crate::error::{Error, Result};
|
||||
use crate::global::{GLOBAL_BOOT_TIME, get_global_endpoints, resolve_object_store_handle};
|
||||
use crate::metrics_realtime::{CollectMetricsOpts, MetricType};
|
||||
use crate::rebalance::RebalSaveOpt;
|
||||
use crate::rpc::PeerRestClient;
|
||||
use crate::runtime_sources;
|
||||
use futures::future::join_all;
|
||||
use lazy_static::lazy_static;
|
||||
use rustfs_madmin::health::{Cpus, MemInfo, OsInfo, Partitions, ProcInfo, SysConfig, SysErrors, SysServices};
|
||||
@@ -289,7 +289,7 @@ impl NotificationSys {
|
||||
S: StorageAdminApi<BackendInfo = rustfs_madmin::BackendInfo, StorageInfo = rustfs_madmin::StorageInfo>,
|
||||
{
|
||||
let mut futures = Vec::with_capacity(self.peer_clients.len());
|
||||
let endpoints = get_global_endpoints();
|
||||
let endpoints = runtime_sources::endpoint_pools().unwrap_or_else(|| Vec::new().into());
|
||||
let peer_timeout = Duration::from_secs(5);
|
||||
|
||||
for (idx, client) in self.peer_clients.iter().enumerate() {
|
||||
@@ -334,7 +334,7 @@ impl NotificationSys {
|
||||
|
||||
pub async fn server_info(&self) -> Vec<ServerProperties> {
|
||||
let mut futures = Vec::with_capacity(self.peer_clients.len());
|
||||
let endpoints = get_global_endpoints();
|
||||
let endpoints = runtime_sources::endpoint_pools().unwrap_or_else(|| Vec::new().into());
|
||||
let peer_timeout = Duration::from_secs(5);
|
||||
|
||||
for (idx, client) in self.peer_clients.iter().enumerate() {
|
||||
@@ -595,7 +595,7 @@ impl NotificationSys {
|
||||
state = "started",
|
||||
"notification peer propagation"
|
||||
);
|
||||
let Some(store) = resolve_object_store_handle() else {
|
||||
let Some(store) = runtime_sources::object_store_handle() else {
|
||||
error!(
|
||||
event = EVENT_NOTIFICATION_PEER_PROPAGATION,
|
||||
component = LOG_COMPONENT_ECSTORE,
|
||||
@@ -1107,11 +1107,7 @@ fn initializing_server_properties(host: &str) -> ServerProperties {
|
||||
|
||||
fn offline_server_properties(host: &str, endpoints: &EndpointServerPools) -> ServerProperties {
|
||||
ServerProperties {
|
||||
uptime: GLOBAL_BOOT_TIME
|
||||
.get()
|
||||
.and_then(|boot_time| SystemTime::now().duration_since(*boot_time).ok())
|
||||
.unwrap_or_default()
|
||||
.as_secs(),
|
||||
uptime: runtime_sources::boot_uptime_secs(),
|
||||
version: get_commit_id(),
|
||||
endpoint: host.to_string(),
|
||||
state: ItemState::Offline.to_string().to_owned(),
|
||||
|
||||
@@ -35,7 +35,6 @@ use crate::error::{Error, Result};
|
||||
use crate::error::{
|
||||
StorageError, is_err_bucket_exists, is_err_bucket_not_found, is_err_object_not_found, is_err_version_not_found,
|
||||
};
|
||||
use crate::global::resolve_object_store_handle;
|
||||
use crate::object_api::{GetObjectReader, ObjectOptions};
|
||||
use crate::rebalance::{REBAL_META_NAME, RebalanceMeta, is_rebalance_conflicting_with_decommission};
|
||||
use crate::runtime_sources;
|
||||
@@ -2420,7 +2419,7 @@ impl ECStore {
|
||||
|
||||
self.ensure_decommission_rebalance_idle_after_refresh().await?;
|
||||
|
||||
let store = require_decommission_store(resolve_object_store_handle(), "start decommission")?;
|
||||
let store = require_decommission_store(runtime_sources::object_store_handle(), "start decommission")?;
|
||||
let local_indices = local_decommission_queue_prefix(&self.endpoints(), &indices)?;
|
||||
|
||||
self.start_decommission(indices.clone()).await?;
|
||||
|
||||
@@ -38,7 +38,6 @@ use tracing::{debug, error, info, warn};
|
||||
|
||||
use crate::client::admin_handler_utils::AdminError;
|
||||
use crate::error::{Error, Result, StorageError};
|
||||
use crate::global::resolve_object_store_handle;
|
||||
use crate::tier::{
|
||||
tier_admin::TierCreds,
|
||||
tier_config::{TierConfig, TierType},
|
||||
@@ -1026,7 +1025,7 @@ impl TierConfigMgr {
|
||||
|
||||
#[tracing::instrument(level = "debug", name = "tier_save", skip(self))]
|
||||
pub async fn save(&self) -> std::result::Result<(), std::io::Error> {
|
||||
let Some(api) = resolve_object_store_handle() else {
|
||||
let Some(api) = runtime_sources::object_store_handle() else {
|
||||
return Err(tier_config_not_initialized_error("save tiering config"));
|
||||
};
|
||||
//let (pr, opts) = GLOBAL_TierConfigMgr.write().config_reader()?;
|
||||
|
||||
Reference in New Issue
Block a user