sova_rate_limit/events.rs
1//! Domain events emitted on the app [`EventBus`](sova_core::EventBus).
2
3use sova_core::Event;
4
5/// Fired before a 429 response when a rate limit is exceeded.
6#[derive(Debug, Clone)]
7pub struct RateLimitExceeded {
8 pub key: String,
9 pub limit: u64,
10 pub retry_after: Option<u64>,
11}
12
13impl Event for RateLimitExceeded {
14 fn name(&self) -> &'static str {
15 "rate_limit.exceeded"
16 }
17}