//! Daemon events. //! //! Events are the primary communication mechanism within the daemon. //! Components emit events to notify others of state changes, and handle //! events to react to changes elsewhere in the system. //! //! External processes (like CLI commands) can also inject events via the //! Control gRPC service. use turtle::history::History; /// Events that flow through the daemon's event bus. /// /// Events are broadcast to all components. Each component decides which /// events it cares about in its `handle_event` implementation. #[derive(Debug, Clone)] pub(crate) enum DaemonEvent { // ---- History lifecycle ---- /// A command has started running. HistoryStarted(History), /// A command has finished running. HistoryEnded(History), /// Sync completed successfully. SyncCompleted { /// Number of records uploaded. #[expect(unused)] uploaded: usize, /// Number of records downloaded. #[expect(unused)] downloaded: usize, }, /// Sync failed. SyncFailed { /// Error message describing what went wrong. error: String, }, /// Request an immediate sync (external trigger). ForceSync, // ---- Lifecycle ---- /// Request graceful shutdown of the daemon. ShutdownRequested, }