pub struct ApiState {Show 16 fields
pub network_connection_info_provider: Option<Arc<dyn NetworkConnectionInfoProvider>>,
pub agent_service: Option<Arc<dyn AgentService + Send + Sync>>,
pub analytics_service: Arc<dyn AnalyticsService + Send + Sync>,
pub connectome_service: Arc<dyn ConnectomeService + Send + Sync>,
pub genome_service: Arc<dyn GenomeService + Send + Sync>,
pub neuron_service: Arc<dyn NeuronService + Send + Sync>,
pub runtime_service: Arc<dyn RuntimeService + Send + Sync>,
pub system_service: Arc<dyn SystemService + Send + Sync>,
pub snapshot_service: Option<Arc<dyn SnapshotService + Send + Sync>>,
pub feagi_session_timestamp: i64,
pub filesystem_data_root: PathBuf,
pub memory_stats_cache: Option<MemoryStatsCache>,
pub amalgamation_state: SharedAmalgamationState,
pub genome_transition_lock: Arc<Mutex<()>>,
pub genome_transition_in_progress: Arc<AtomicBool>,
pub agent_handler: Option<Arc<Mutex<FeagiAgentHandler>>>,
}Expand description
Application state shared across all HTTP handlers
Fields§
§network_connection_info_provider: Option<Arc<dyn NetworkConnectionInfoProvider>>Optional provider for GET /v1/network/connection_info (None in tests/WASM)
agent_service: Option<Arc<dyn AgentService + Send + Sync>>§analytics_service: Arc<dyn AnalyticsService + Send + Sync>§connectome_service: Arc<dyn ConnectomeService + Send + Sync>§genome_service: Arc<dyn GenomeService + Send + Sync>§neuron_service: Arc<dyn NeuronService + Send + Sync>§runtime_service: Arc<dyn RuntimeService + Send + Sync>§system_service: Arc<dyn SystemService + Send + Sync>§snapshot_service: Option<Arc<dyn SnapshotService + Send + Sync>>§feagi_session_timestamp: i64FEAGI session timestamp in milliseconds (Unix timestamp when FEAGI started) This is a unique identifier for each FEAGI instance/session
filesystem_data_root: PathBufBase directory for default API filesystem writes when the client omits a path
(e.g. POST /v1/genome/save without file_path). Default genome files go under
{filesystem_data_root}/cache/.genome/ (aligned with feagi-python-sdk ~/.feagi/cache).
Set from [system].data_dir / FEAGI_DATA_DIR at startup; when unset, resolves to
{user_home}/.feagi (native) so writes do not use cwd or OS temp (see
ApiState::filesystem_data_root_from_config).
memory_stats_cache: Option<MemoryStatsCache>Memory area stats cache (updated by plasticity service, read by health check)
amalgamation_state: SharedAmalgamationStateIn-memory amalgamation state (pending request + history), surfaced via health_check.
genome_transition_lock: Arc<Mutex<()>>Exclusive lock for genome transition operations (load/upload/reload).
genome_transition_in_progress: Arc<AtomicBool>Indicates whether a prioritized genome transition is currently in progress.
agent_handler: Option<Arc<Mutex<FeagiAgentHandler>>>Agent handler for device registrations and transport management
Implementations§
Source§impl ApiState
impl ApiState
Sourcepub fn init_agent_registration_handler() -> Arc<Mutex<FeagiAgentHandler>>
pub fn init_agent_registration_handler() -> Arc<Mutex<FeagiAgentHandler>>
Initialize the agent handler (deprecated - use external initialization).
Sourcepub fn init_amalgamation_state() -> SharedAmalgamationState
pub fn init_amalgamation_state() -> SharedAmalgamationState
Initialize amalgamation_state field (empty state).
Sourcepub fn init_genome_transition_controls() -> (Arc<Mutex<()>>, Arc<AtomicBool>)
pub fn init_genome_transition_controls() -> (Arc<Mutex<()>>, Arc<AtomicBool>)
Initialize synchronization primitives for strict genome transitions.
Sourcepub fn filesystem_data_root_from_config(data_dir: &Path) -> PathBuf
pub fn filesystem_data_root_from_config(data_dir: &Path) -> PathBuf
Resolve the base directory for default on-disk API writes (e.g. genome save without file_path).
- If
[system].data_diris set (including viaFEAGI_DATA_DIR), returns that path as-is. - Otherwise returns
{user_home}/.feagi, matching feagi-python-sdkFeagiPathsand feagi-desktop runtime layout. If the home directory cannot be resolved, falls back tostd::env::temp_dir().join("feagi"). - wasm32:
/tmp/feagi(no portable home in browser WASM).
Callers append subpaths such as cache/.genome for default genome JSON files.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ApiState
impl !RefUnwindSafe for ApiState
impl Send for ApiState
impl Sync for ApiState
impl Unpin for ApiState
impl UnsafeUnpin for ApiState
impl !UnwindSafe for ApiState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more