kabu_core_components/
kabu_node.rs

1use crate::Component;
2use eyre::Result;
3use reth_tasks::TaskExecutor;
4
5// Note: This file should only contain trait definitions and framework code
6// Concrete implementations should be in the bin/kabu crate or other implementation crates
7
8/// Simple placeholder component for testing the framework
9pub struct PlaceholderComponent {
10    name: &'static str,
11}
12
13impl PlaceholderComponent {
14    pub fn new(name: &'static str) -> Self {
15        Self { name }
16    }
17}
18
19impl Component for PlaceholderComponent {
20    fn spawn(self, executor: TaskExecutor) -> Result<()> {
21        let name = self.name;
22        executor.spawn_critical(name, async move {
23            tracing::info!("{} placeholder component running", name);
24            // Placeholder components just log and stay alive
25            loop {
26                tokio::time::sleep(std::time::Duration::from_secs(60)).await;
27                tracing::debug!("{} placeholder component heartbeat", name);
28            }
29        });
30        Ok(())
31    }
32
33    fn name(&self) -> &'static str {
34        self.name
35    }
36}