mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-28 09:08:58 +00:00
4559baaeeb
- Remove reed-solomon-erasure dependency and all related code - Simplify ReedSolomonEncoder from enum to struct with SIMD-only implementation - Eliminate all conditional compilation (#[cfg(feature = ...)]) - Add instance caching with RwLock-based encoder/decoder reuse - Implement reset mechanism to avoid unnecessary allocations - Ensure thread safety with proper cache management - Update documentation and benchmark scripts for SIMD-only approach - Apply code formatting across all files Breaking Changes: - Removes support for reed-solomon-erasure feature flag - API remains compatible but implementation is now SIMD-only Performance Impact: - Improved encoding/decoding performance through SIMD optimization - Reduced memory allocations via instance caching - Enhanced thread safety and concurrency support
72 lines
2.0 KiB
Rust
72 lines
2.0 KiB
Rust
//! RustFS Notify - A flexible and extensible event notification system for object storage.
|
|
//!
|
|
//! This library provides a Rust implementation of a storage bucket notification system,
|
|
//! similar to RustFS's notification system. It supports sending events to various targets
|
|
//! (like Webhook and MQTT) and includes features like event persistence and retry on failure.
|
|
|
|
pub mod arn;
|
|
pub mod error;
|
|
pub mod event;
|
|
pub mod factory;
|
|
pub mod global;
|
|
pub mod integration;
|
|
pub mod notifier;
|
|
pub mod registry;
|
|
pub mod rules;
|
|
pub mod store;
|
|
pub mod stream;
|
|
pub mod target;
|
|
|
|
// Re-exports
|
|
pub use error::{NotificationError, StoreError, TargetError};
|
|
pub use event::{Event, EventArgs, EventLog, EventName};
|
|
pub use global::{initialize, notification_system};
|
|
pub use integration::NotificationSystem;
|
|
pub use rules::BucketNotificationConfig;
|
|
use std::io::IsTerminal;
|
|
pub use target::Target;
|
|
|
|
use tracing_subscriber::{EnvFilter, fmt, prelude::*, util::SubscriberInitExt};
|
|
|
|
/// Initialize the tracing log system
|
|
///
|
|
/// # Example
|
|
/// ```
|
|
/// rustfs_notify::init_logger(rustfs_notify::LogLevel::Info);
|
|
/// ```
|
|
pub fn init_logger(level: LogLevel) {
|
|
let filter = EnvFilter::default().add_directive(level.into());
|
|
tracing_subscriber::registry()
|
|
.with(filter)
|
|
.with(
|
|
fmt::layer()
|
|
.with_target(true)
|
|
.with_target(true)
|
|
.with_ansi(std::io::stdout().is_terminal())
|
|
.with_thread_names(true)
|
|
.with_thread_ids(true)
|
|
.with_file(true)
|
|
.with_line_number(true),
|
|
)
|
|
.init();
|
|
}
|
|
|
|
/// Log level definition
|
|
pub enum LogLevel {
|
|
Debug,
|
|
Info,
|
|
Warn,
|
|
Error,
|
|
}
|
|
|
|
impl From<LogLevel> for tracing_subscriber::filter::Directive {
|
|
fn from(level: LogLevel) -> Self {
|
|
match level {
|
|
LogLevel::Debug => "debug".parse().unwrap(),
|
|
LogLevel::Info => "info".parse().unwrap(),
|
|
LogLevel::Warn => "warn".parse().unwrap(),
|
|
LogLevel::Error => "error".parse().unwrap(),
|
|
}
|
|
}
|
|
}
|