This commit is contained in:
houseme
2025-06-23 04:15:05 +08:00
parent 928453db62
commit 5155a3d544
8 changed files with 16 additions and 20 deletions
+2 -3
View File
@@ -4,12 +4,11 @@ use rustfs_notify::factory::{
DEFAULT_TARGET, MQTT_BROKER, MQTT_PASSWORD, MQTT_QOS, MQTT_QUEUE_DIR, MQTT_QUEUE_LIMIT, MQTT_TOPIC, MQTT_USERNAME,
NOTIFY_MQTT_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS, WEBHOOK_AUTH_TOKEN, WEBHOOK_ENDPOINT, WEBHOOK_QUEUE_DIR, WEBHOOK_QUEUE_LIMIT,
};
use rustfs_notify::global::notification_system;
use rustfs_notify::store::DEFAULT_LIMIT;
use rustfs_notify::{init_logger, BucketNotificationConfig, Event, EventName, LogLevel, NotificationError};
use rustfs_notify::{initialize, notification_system};
use std::time::Duration;
use tracing::info;
use tracing_subscriber::util::SubscriberInitExt;
#[tokio::main]
async fn main() -> Result<(), NotificationError> {
@@ -19,7 +18,7 @@ async fn main() -> Result<(), NotificationError> {
Some(sys) => sys,
None => {
let config = Config::new();
notification_system::initialize(config).await?;
initialize(config).await?;
notification_system().expect("Failed to initialize notification system")
}
};
+2 -3
View File
@@ -5,12 +5,11 @@ use rustfs_notify::factory::{
DEFAULT_TARGET, MQTT_BROKER, MQTT_PASSWORD, MQTT_QOS, MQTT_QUEUE_DIR, MQTT_QUEUE_LIMIT, MQTT_TOPIC, MQTT_USERNAME,
NOTIFY_MQTT_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS, WEBHOOK_AUTH_TOKEN, WEBHOOK_ENDPOINT, WEBHOOK_QUEUE_DIR, WEBHOOK_QUEUE_LIMIT,
};
use rustfs_notify::global::notification_system;
use rustfs_notify::store::DEFAULT_LIMIT;
use rustfs_notify::{init_logger, BucketNotificationConfig, Event, EventName, LogLevel, NotificationError};
use rustfs_notify::{initialize, notification_system};
use std::time::Duration;
use tracing::info;
use tracing_subscriber::util::SubscriberInitExt;
#[tokio::main]
async fn main() -> Result<(), NotificationError> {
@@ -21,7 +20,7 @@ async fn main() -> Result<(), NotificationError> {
Some(sys) => sys,
None => {
let config = Config::new();
notification_system::initialize(config).await?;
initialize(config).await?;
notification_system().expect("Failed to initialize notification system")
}
};
+6 -7
View File
@@ -488,13 +488,12 @@ impl Event {
s3_metadata.object.etag = args.object.etag.clone();
s3_metadata.object.content_type = args.object.content_type.clone();
// Filter out internal reserved metadata
let user_metadata = args
.object
.user_defined
.iter()
.filter(|&(k, v)| !k.to_lowercase().starts_with("x-amz-meta-internal-"))
.map(|(k, v)| (k.clone(), v.clone()))
.collect::<HashMap<String, String>>();
let mut user_metadata = HashMap::new();
for (k, v) in &args.object.user_defined.unwrap_or_default() {
if !k.to_lowercase().starts_with("x-amz-meta-internal-") {
user_metadata.insert(k.clone(), v.clone());
}
}
s3_metadata.object.user_metadata = Some(user_metadata);
}
+1 -1
View File
@@ -32,7 +32,7 @@ pub struct Notifier {
// Rely on getting an instance of NotificationSystem from the outside.
}
impl crate::notifier::Notifier {
impl Notifier {
/// Notify an event asynchronously.
/// This is the only entry point for all event notifications in the system.
pub async fn notify(&self, args: EventArgs) {