32 lines
999 B
Rust
32 lines
999 B
Rust
/// System event watcher — M1 implementation.
|
|
///
|
|
/// M0 stub: defines the types and the spawn interface so the rest of the app
|
|
/// can wire up event handling now. Actual journald/dmesg reading lands in M1.
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum EventSeverity {
|
|
Info,
|
|
Warn,
|
|
Crit,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct SystemEvent {
|
|
pub severity: EventSeverity,
|
|
pub source: String,
|
|
pub message: String,
|
|
pub timestamp: u64,
|
|
}
|
|
|
|
/// Starts the background watcher task.
|
|
/// M0: no-op placeholder — returns immediately.
|
|
/// M1: spawns a tokio task reading journald + dmesg and emitting events.
|
|
pub fn spawn() {
|
|
// TODO(M1): spawn tokio::task reading journald via sd-journal crate
|
|
// TODO(M1): spawn dmesg poller for kernel messages
|
|
// TODO(M1): emit SystemEvent via tauri app_handle.emit()
|
|
log::info!("watcher: stub — no-op until M1");
|
|
}
|