mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-21 11:56:38 +00:00
refactor: centralize ecstore bucket runtime sources (#3806)
This commit is contained in:
@@ -21,7 +21,7 @@ use crate::bucket::target::ARN;
|
||||
use crate::bucket::target::BucketTargetType;
|
||||
use crate::bucket::target::{self, BucketTarget, BucketTargets, Credentials};
|
||||
use crate::bucket::versioning_sys::BucketVersioningSys;
|
||||
use crate::global::get_global_bucket_monitor;
|
||||
use crate::runtime_sources;
|
||||
use aws_credential_types::Credentials as SdkCredentials;
|
||||
use aws_sdk_s3::config::Region as SdkRegion;
|
||||
use aws_sdk_s3::error::ProvideErrorMetadata;
|
||||
@@ -698,7 +698,7 @@ impl BucketTargetSys {
|
||||
}
|
||||
|
||||
fn update_bandwidth_limit(&self, bucket: &str, arn: &str, limit: i64) {
|
||||
if let Some(bucket_monitor) = get_global_bucket_monitor() {
|
||||
if let Some(bucket_monitor) = runtime_sources::bucket_monitor() {
|
||||
if limit == 0 {
|
||||
bucket_monitor.delete_bucket_throttle(bucket, arn);
|
||||
return;
|
||||
|
||||
@@ -28,7 +28,6 @@ use crate::config::com::save_config;
|
||||
use crate::disk::{BUCKET_META_PREFIX, RUSTFS_META_BUCKET};
|
||||
use crate::error::{Error, Result, is_err_object_not_found, is_err_version_not_found};
|
||||
use crate::event_notification::{EventArgs, send_event};
|
||||
use crate::global::get_global_bucket_monitor;
|
||||
use crate::global::resolve_object_store_handle;
|
||||
use crate::object_api::{GetObjectReader, ObjectInfo, ObjectOptions, PutObjReader};
|
||||
use crate::runtime_sources;
|
||||
@@ -3698,7 +3697,7 @@ fn wrap_with_bandwidth_monitor_with_header(
|
||||
arn: &str,
|
||||
header_size: usize,
|
||||
) -> Box<dyn AsyncRead + Unpin + Send + Sync> {
|
||||
if let Some(monitor) = get_global_bucket_monitor() {
|
||||
if let Some(monitor) = runtime_sources::bucket_monitor() {
|
||||
Box::new(MonitoredReader::new(
|
||||
monitor,
|
||||
stream,
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::bucket::replication::get_global_replication_pool;
|
||||
use crate::error::Error;
|
||||
use crate::global::get_global_bucket_monitor;
|
||||
use crate::runtime_sources;
|
||||
use rustfs_filemeta::{ReplicatedTargetInfo, ReplicationStatusType, ReplicationType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
@@ -887,7 +886,7 @@ impl ReplicationStats {
|
||||
let mut interval = interval(Duration::from_secs(2));
|
||||
loop {
|
||||
interval.tick().await;
|
||||
let current = get_global_replication_pool()
|
||||
let current = runtime_sources::replication_pool()
|
||||
.map(|pool| pool.active_workers() + pool.active_lrg_workers() + pool.active_mrf_workers())
|
||||
.unwrap_or(0);
|
||||
let mut workers = workers_clone.lock().await;
|
||||
@@ -1246,7 +1245,7 @@ impl ReplicationStats {
|
||||
};
|
||||
drop(cache);
|
||||
|
||||
if let Some(monitor) = get_global_bucket_monitor() {
|
||||
if let Some(monitor) = runtime_sources::bucket_monitor() {
|
||||
let bw_report = monitor.get_report(|name| name == bucket);
|
||||
for (opts, bw) in bw_report.bucket_stats {
|
||||
let stat = replication_stats
|
||||
|
||||
Reference in New Issue
Block a user