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 ConfigurationService::ConfigurationServiceImpl
10
11/// Service configuration
12#[derive(Debug, Clone)]
13pub struct ServiceConfig {
14	/// Enable service
15	pub enabled:bool,
16	/// Service name
17	pub name:String,
18}
19
20/// Service trait
21pub trait Service: Send + Sync {
22	/// Get service name
23	fn name(&self) -> &str;
24
25	/// Start the service
26	async fn start(&self) -> anyhow::Result<()>;
27
28	/// Stop the service
29	async fn stop(&self) -> anyhow::Result<()>;
30
31	/// Check if service is running
32	async fn is_running(&self) -> bool;
33}
34
35#[cfg(test)]
36mod tests {
37	use super::*;
38
39	#[test]
40	fn test_service_config() {
41		let config = ServiceConfig { enabled:true, name:"test-service".to_string() };
42		assert_eq!(config.name, "test-service");
43		assert!(config.enabled);
44	}
45}