pub struct AppManager { /* private fields */ }Expand description
Application lifecycle manager.
Tracks installed applications and their lifecycle state. Agent spawning and service starting are delegated to the supervisor and container manager respectively – those integrations are wired in the kernel boot sequence.
Implementations§
Source§impl AppManager
impl AppManager
Sourcepub fn install(&self, manifest: AppManifest) -> Result<String, AppError>
pub fn install(&self, manifest: AppManifest) -> Result<String, AppError>
Register an application from a parsed manifest.
The app is placed in the Installed state. Call transition_to
to advance the state (e.g., to Starting or Running).
§Errors
Returns AppError::AlreadyInstalled if an app with the same
name is already registered.
Sourcepub fn transition_to(
&self,
name: &str,
new_state: AppState,
) -> Result<(), AppError>
pub fn transition_to( &self, name: &str, new_state: AppState, ) -> Result<(), AppError>
Transition an app to a new state.
Validates that the transition is legal per the state machine:
- Installed -> Starting
- Starting -> Running | Failed
- Running -> Stopping
- Stopping -> Stopped | Failed
- Stopped -> Starting
§Errors
Returns AppError::NotFound or AppError::InvalidState.
Sourcepub fn add_agent_pid(&self, name: &str, pid: Pid) -> Result<(), AppError>
pub fn add_agent_pid(&self, name: &str, pid: Pid) -> Result<(), AppError>
Record an agent PID for a running app.
Sourcepub fn add_service_name(
&self,
name: &str,
service_name: String,
) -> Result<(), AppError>
pub fn add_service_name( &self, name: &str, service_name: String, ) -> Result<(), AppError>
Record a service name for a running app.
Sourcepub fn remove(&self, name: &str) -> Result<AppManifest, AppError>
pub fn remove(&self, name: &str) -> Result<AppManifest, AppError>
Remove an installed application.
The app must be in Installed, Stopped, or Failed state.
Sourcepub fn inspect(&self, name: &str) -> Result<InstalledApp, AppError>
pub fn inspect(&self, name: &str) -> Result<InstalledApp, AppError>
Get details for an installed application.
Sourcepub fn namespaced_agent_ids(manifest: &AppManifest) -> Vec<String>
pub fn namespaced_agent_ids(manifest: &AppManifest) -> Vec<String>
Get namespaced agent IDs for an app’s manifest.
Returns IDs in the form app-name/agent-id.
Sourcepub fn namespaced_tool_names(manifest: &AppManifest) -> Vec<String>
pub fn namespaced_tool_names(manifest: &AppManifest) -> Vec<String>
Get namespaced tool names for an app’s manifest.
Returns names in the form app-name/tool-name.
Sourcepub fn start(&self, name: &str) -> Result<Vec<SpawnRequest>, AppError>
pub fn start(&self, name: &str) -> Result<Vec<SpawnRequest>, AppError>
Start an installed or stopped application.
Transitions the app through Starting to Running and builds
SpawnRequests for each agent declared in the manifest. The
caller (kernel boot / CLI) is responsible for executing the spawn
requests via the [AgentSupervisor].
Returns the list of spawn requests so the caller can hand them to the supervisor.
§Errors
Returns AppError::NotFound if the app is not installed, or
AppError::InvalidState if the app is not in Installed or
Stopped state.
Sourcepub fn stop(&self, name: &str) -> Result<(), AppError>
pub fn stop(&self, name: &str) -> Result<(), AppError>
Stop a running application.
Transitions Running -> Stopping -> Stopped and clears the
recorded agent PIDs and service names.
§Errors
Returns AppError::NotFound or AppError::InvalidState.
Sourcepub fn build_spawn_requests(manifest: &AppManifest) -> Vec<SpawnRequest>
pub fn build_spawn_requests(manifest: &AppManifest) -> Vec<SpawnRequest>
Build SpawnRequests for every agent declared in a manifest.
Each request carries the agent’s capabilities from the manifest
and a namespaced agent ID (app-name/agent-id).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppManager
impl !RefUnwindSafe for AppManager
impl Send for AppManager
impl Sync for AppManager
impl Unpin for AppManager
impl UnsafeUnpin for AppManager
impl UnwindSafe for AppManager
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> 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