improve code for notify

This commit is contained in:
houseme
2025-06-21 10:35:07 +08:00
parent 48d530cb13
commit e0f65e5e24
14 changed files with 442 additions and 634 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ use tracing::warn;
pub const RPC_PREFIX: &str = "/rustfs/rpc";
pub fn regist_rpc_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
pub fn register_rpc_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
r.insert(
Method::GET,
format!("{}{}", RPC_PREFIX, "/read_file_stream").as_str(),
+3 -3
View File
@@ -1,4 +1,4 @@
use rustfs_notify::EventNotifierConfig;
// use rustfs_notify::EventNotifierConfig;
use tracing::{info, instrument};
#[instrument]
@@ -7,11 +7,11 @@ pub(crate) async fn init_event_notifier(notifier_config: Option<String>) {
let notifier_config_present = notifier_config.is_some();
let config = if notifier_config_present {
info!("event_config is not empty, path: {:?}", notifier_config);
EventNotifierConfig::event_load_config(notifier_config)
// EventNotifierConfig::event_load_config(notifier_config)
} else {
info!("event_config is empty");
// rustfs_notify::get_event_notifier_config().clone()
EventNotifierConfig::default()
// EventNotifierConfig::default()
};
info!("using event_config: {:?}", config);
-17
View File
@@ -1,18 +1 @@
use rustfs_notify::{Event, Metadata};
/// Create a new metadata object
#[allow(dead_code)]
pub(crate) fn create_metadata() -> Metadata {
// Create a new metadata object
let mut metadata = Metadata::new();
metadata.set_configuration_id("test-config".to_string());
// Return the created metadata object
metadata
}
/// Create a new event object
#[allow(dead_code)]
pub(crate) async fn send_event(event: Event) -> Result<(), Box<dyn std::error::Error>> {
// rustfs_notify::send_event(event).await.map_err(|e| e.into())
Ok(())
}