From 63a0ec3901a863fb07d18f4b814a98a813644382 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 20 Jul 2026 14:18:36 +0200 Subject: chore: Commit --- crates/daemon/src/daemon.rs | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'crates/daemon/src/daemon.rs') diff --git a/crates/daemon/src/daemon.rs b/crates/daemon/src/daemon.rs index 4e691be2..2e236f4e 100644 --- a/crates/daemon/src/daemon.rs +++ b/crates/daemon/src/daemon.rs @@ -248,7 +248,6 @@ pub(crate) trait Component: Send + Sync { /// Events emitted during handling are queued and processed in subsequent /// iterations, ensuring the loop eventually drains. pub(crate) struct Daemon { - components: Vec>, handle: DaemonHandle, } @@ -269,14 +268,12 @@ impl Daemon { /// /// This must be called before `run_event_loop()`. It initializes all /// registered components with the daemon handle. - pub(crate) async fn start_components(&mut self) -> Result<()> { - for component in &mut self.components { - tracing::info!(component = component.name(), "starting component"); - component - .start(self.handle.clone()) - .await - .with_context(|| format!("failed to start component: {}", component.name()))?; - } + pub(crate) async fn start_component(&mut self, component: &mut impl Component) -> Result<()> { + tracing::info!(component = component.name(), "starting component"); + component + .start(self.handle.clone()) + .await + .with_context(|| format!("failed to start component: {}", component.name()))?; Ok(()) } @@ -365,7 +362,7 @@ pub(crate) struct DaemonBuilder { settings: Settings, store: Option, history_db: Option, - components: Vec>, + components: Vec>>, } impl DaemonBuilder { @@ -391,14 +388,6 @@ impl DaemonBuilder { self } - /// Register a component. - /// - /// Components are started in registration order and stopped in reverse order. - pub(crate) fn component(mut self, component: impl Component + 'static) -> Self { - self.components.push(Box::new(component)); - self - } - /// Build the daemon. /// /// This loads the encryption key and creates the daemon state. @@ -428,9 +417,6 @@ impl DaemonBuilder { // Create the handle (just a reference to the state) let handle = DaemonHandle { state }; - Ok(Daemon { - components: self.components, - handle, - }) + Ok(Daemon { handle }) } } -- cgit v1.3.1