use crate::BucketNotificationConfig;
use crate::rules::{BucketRulesSnapshot, DynRulesContainer, SubscriberIndex};
use rustfs_s3_types::EventName;
#[derive(Debug)]
pub struct NotificationSystemSubscriberView {
index: SubscriberIndex,
}
impl NotificationSystemSubscriberView {
pub fn new() -> Self {
Self {
index: SubscriberIndex::default(),
}
}
#[inline]
pub fn has_subscriber(&self, bucket: &str, event: &EventName) -> bool {
self.index.has_subscriber(bucket, event)
}
pub fn apply_bucket_config(&self, bucket: &str, cfg: &BucketNotificationConfig) {
let snapshot: BucketRulesSnapshot<DynRulesContainer> = cfg.compile_snapshot();
snapshot.debug_assert_mask_consistent();
self.index.store_snapshot(bucket, snapshot);
}
#[inline]
pub fn clear_bucket(&self, bucket: &str) {
self.index.clear_bucket(bucket);
}
}