Skip to main content

Grove/Services/
mod.rs

1//! Services Module
2//!
3//! Provides various services for Grove operation.
4//! Includes configuration service, logging service, and more.
5
6pub mod ConfigurationService;
7
8// Re-exports for convenience - use module prefix to avoid E0255 conflicts
9// Note: ConfigurationService must be accessed via
10// ConfigurationService::ConfigurationServiceImpl
11
12/// Service configuration
13#[derive(Debug, Clone)]
14pub struct ServiceConfig {
15	/// Enable service
16	pub enabled:bool,
17	/// Service name
18	pub name:String,
19}
20
21/// Service trait
22#[allow(async_fn_in_trait)]
23pub trait Service: Send + Sync {
24	/// Get service name
25	fn name(&self) -> &str;
26
27	/// Start the service
28	async fn start(&self) -> anyhow::Result<()>;
29
30	/// Stop the service
31	async fn stop(&self) -> anyhow::Result<()>;
32
33	/// Check if service is running
34	async fn is_running(&self) -> bool;
35}
36
37#[cfg(test)]
38mod tests {
39	use super::*;
40
41	#[test]
42	fn test_service_config() {
43		let config = ServiceConfig { enabled:true, name:"test-service".to_string() };
44		assert_eq!(config.name, "test-service");
45		assert!(config.enabled);
46	}
47}