//! Watch/notification system for Chainfire distributed KVS
//!
//! This crate provides:
//! - Watch subscription registry
//! - Prefix/key matching
//! - Event dispatch to subscribers
//! - Watch stream management

pub mod matcher;
pub mod registry;
pub mod stream;

pub use matcher::KeyMatcher;
pub use registry::WatchRegistry;
pub use stream::WatchStream;

use std::sync::atomic::{AtomicI64, Ordering};

/// Global watch ID counter
static WATCH_ID_COUNTER: AtomicI64 = AtomicI64::new(1);

/// Generate a new unique watch ID
pub fn next_watch_id() -> i64 {
    WATCH_ID_COUNTER.fetch_add(1, Ordering::SeqCst)
}
