Skip to main content

shape_runtime/alerts/
sinks.rs

1//! Alert Sinks
2//!
3//! Output sinks for alert delivery.
4
5use super::types::Alert;
6use shape_ast::error::Result;
7
8/// Trait for alert output sinks
9///
10/// Implement this trait to create custom alert destinations.
11///
12/// CLI-specific sinks (like ConsoleSink) should be implemented in shape-cli.
13pub trait AlertSink: Send + Sync {
14    /// Get the sink name
15    fn name(&self) -> &str;
16
17    /// Send an alert to this sink
18    fn send(&self, alert: &Alert) -> Result<()>;
19
20    /// Flush any pending alerts
21    fn flush(&self) -> Result<()> {
22        Ok(()) // Default: no-op
23    }
24
25    /// Get the tags this sink handles
26    ///
27    /// Returns an empty slice to handle all alerts.
28    fn handles_tags(&self) -> &[String] {
29        &[]
30    }
31}