Skip to main content

feagi_services/traits/
system_service.rs

1// Copyright 2025 Neuraville Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4/*!
5System service trait.
6
7Provides system health, status, and configuration operations.
8
9Copyright 2025 Neuraville Inc.
10Licensed under the Apache License, Version 2.0
11*/
12
13use crate::types::*;
14use async_trait::async_trait;
15
16/// System service (transport-agnostic)
17#[async_trait]
18pub trait SystemService: Send + Sync {
19    // ========================================================================
20    // HEALTH & STATUS
21    // ========================================================================
22
23    /// Get system health status
24    ///
25    /// # Returns
26    /// * `HealthStatus` - Overall system health with component statuses
27    ///
28    async fn get_health(&self) -> ServiceResult<HealthStatus>;
29
30    /// Get system status (comprehensive information)
31    ///
32    /// # Returns
33    /// * `SystemStatus` - Detailed system status including counters, memory, uptime
34    ///
35    async fn get_status(&self) -> ServiceResult<SystemStatus>;
36
37    /// Get system version information
38    ///
39    /// # Returns
40    /// * `VersionInfo` - Version numbers for all components
41    ///
42    async fn get_version(&self) -> ServiceResult<VersionInfo>;
43
44    // ========================================================================
45    // RUNTIME CONTROL
46    // ========================================================================
47
48    /// Check if the system is initialized (has a loaded genome)
49    ///
50    /// # Returns
51    /// * `bool` - True if system is initialized
52    ///
53    async fn is_initialized(&self) -> ServiceResult<bool>;
54
55    /// Get the current burst count (total bursts executed)
56    ///
57    /// # Returns
58    /// * `u64` - Total burst count
59    ///
60    async fn get_burst_count(&self) -> ServiceResult<u64>;
61
62    /// Get runtime statistics
63    ///
64    /// # Returns
65    /// * `RuntimeStats` - Detailed runtime statistics
66    ///
67    async fn get_runtime_stats(&self) -> ServiceResult<RuntimeStats>;
68
69    // ========================================================================
70    // MEMORY & RESOURCES
71    // ========================================================================
72
73    /// Get memory usage information
74    ///
75    /// # Returns
76    /// * `MemoryUsage` - Current memory usage across all components
77    ///
78    async fn get_memory_usage(&self) -> ServiceResult<MemoryUsage>;
79
80    /// Get capacity information (max neurons, synapses, etc.)
81    ///
82    /// # Returns
83    /// * `CapacityInfo` - Current and maximum capacities
84    ///
85    async fn get_capacity(&self) -> ServiceResult<CapacityInfo>;
86}