notification_sys base

This commit is contained in:
weisd
2024-12-04 10:55:09 +08:00
parent 9533e312b1
commit e39775bb34
17 changed files with 64 additions and 57 deletions
+19 -9
View File
@@ -5,6 +5,7 @@ use crate::disk::{BUCKET_META_PREFIX, RUSTFS_META_BUCKET};
use crate::error::{Error, Result};
use crate::heal::heal_commands::HealOpts;
use crate::new_object_layer_fn;
use crate::notification_sys::get_global_notification_sys;
use crate::store_api::{BucketOptions, MakeBucketOptions, StorageAPI};
use crate::store_err::{is_err_bucket_exists, StorageError};
use crate::utils::path::{path_join, SLASH_SEPARATOR};
@@ -12,6 +13,7 @@ use crate::{sets::Sets, store::ECStore};
use byteorder::{ByteOrder, LittleEndian, WriteBytesExt};
use rmp_serde::{Deserializer, Serializer};
use serde::{Deserialize, Serialize};
use std::fmt::Display;
use std::io::{Cursor, Write};
use std::path::PathBuf;
use std::sync::Arc;
@@ -270,7 +272,7 @@ impl PoolMeta {
}
}
fn path2_bucket_object(name: &String) -> (String, String) {
fn path2_bucket_object(name: &str) -> (String, String) {
path2_bucket_object_with_base_path("", name)
}
@@ -374,11 +376,13 @@ pub struct DecomBucketInfo {
pub prefix: String,
}
impl ToString for DecomBucketInfo {
fn to_string(&self) -> String {
path_join(&[PathBuf::from(self.name.clone()), PathBuf::from(self.prefix.clone())])
.to_string_lossy()
.to_string()
impl Display for DecomBucketInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
path_join(&[PathBuf::from(self.name.clone()), PathBuf::from(self.prefix.clone())]).to_string_lossy()
)
}
}
@@ -531,7 +535,9 @@ impl ECStore {
let mut pool_meta = self.pool_meta.write().await;
if pool_meta.decommission_failed(idx) {
pool_meta.save(self.pools.clone()).await?;
// FIXME: globalNotificationSys.ReloadPoolMeta(ctx)
if let Some(notification_sys) = get_global_notification_sys() {
notification_sys.reload_pool_meta().await;
}
}
Ok(())
@@ -545,7 +551,9 @@ impl ECStore {
let mut pool_meta = self.pool_meta.write().await;
if pool_meta.decommission_complete(idx) {
pool_meta.save(self.pools.clone()).await?;
// FIXME: globalNotificationSys.ReloadPoolMeta(ctx)
if let Some(notification_sys) = get_global_notification_sys() {
notification_sys.reload_pool_meta().await;
}
}
Ok(())
@@ -641,7 +649,9 @@ impl ECStore {
pool_meta.save(self.pools.clone()).await?;
// FIXME: globalNotificationSys.ReloadPoolMeta(ctx)
if let Some(notification_sys) = get_global_notification_sys() {
notification_sys.reload_pool_meta().await;
}
Ok(())
}