use std::time::SystemTime;
#[derive(Debug, Clone)]
pub enum ShmEvent {
CommandLockAcquired {
cmd_hash: String,
pid: u32,
timestamp: SystemTime,
},
CommandLockReleased {
cmd_hash: String,
pid: u32,
timestamp: SystemTime,
},
CircuitBreakerOpened {
target: String,
failures: u32,
timestamp: SystemTime,
},
CircuitBreakerClosed {
target: String,
timestamp: SystemTime,
},
CircuitBreakerHalfOpened {
target: String,
timestamp: SystemTime,
},
ProviderMetricsUpdated {
provider: String,
success_rate: f32,
timestamp: SystemTime,
},
XpEarned {
agent_id: String,
amount: u64,
new_level: u32,
timestamp: SystemTime,
},
}
impl ShmEvent {
pub fn timestamp(&self) -> SystemTime {
match self {
ShmEvent::CommandLockAcquired { timestamp, .. } => *timestamp,
ShmEvent::CommandLockReleased { timestamp, .. } => *timestamp,
ShmEvent::CircuitBreakerOpened { timestamp, .. } => *timestamp,
ShmEvent::CircuitBreakerClosed { timestamp, .. } => *timestamp,
ShmEvent::CircuitBreakerHalfOpened { timestamp, .. } => *timestamp,
ShmEvent::ProviderMetricsUpdated { timestamp, .. } => *timestamp,
ShmEvent::XpEarned { timestamp, .. } => *timestamp,
}
}
}