pub struct AdapterInstanceManager {
pub adapters: HashMap<String, AdapterDef>,
pub adapters_dir: String,
/* private fields */
}Expand description
Adapter Instance Manager
Fields§
§adapters: HashMap<String, AdapterDef>Discovered adapter definitions
adapters_dir: StringAdapters directory path
Implementations§
Source§impl AdapterInstanceManager
impl AdapterInstanceManager
pub fn new( adapters_dir: String, port_range: (u16, u16), gateway_listen: &str, ) -> Result<Self, AppError>
Sourcepub fn has_adapter(&self, name: &str) -> bool
pub fn has_adapter(&self, name: &str) -> bool
Check if an adapter exists
Sourcepub async fn spawn(
&self,
credential_id: &str,
adapter_name: &str,
token: &str,
config: Option<&Value>,
) -> Result<(String, u16), AppError>
pub async fn spawn( &self, credential_id: &str, adapter_name: &str, token: &str, config: Option<&Value>, ) -> Result<(String, u16), AppError>
Spawn an adapter process for a credential
Sourcepub async fn get_port(&self, credential_id: &str) -> Option<u16>
pub async fn get_port(&self, credential_id: &str) -> Option<u16>
Get the port for a credential’s adapter
Sourcepub async fn get_instance_id(&self, credential_id: &str) -> Option<String>
pub async fn get_instance_id(&self, credential_id: &str) -> Option<String>
Get instance_id for a credential
Sourcepub async fn is_running(&self, credential_id: &str) -> bool
pub async fn is_running(&self, credential_id: &str) -> bool
Check if adapter process is running for a credential
Sourcepub async fn get_credential_id(&self, instance_id: &str) -> Option<String>
pub async fn get_credential_id(&self, instance_id: &str) -> Option<String>
Find credential_id by instance_id
Sourcepub async fn check_health(&self, credential_id: &str) -> AdapterHealth
pub async fn check_health(&self, credential_id: &str) -> AdapterHealth
Check health of a specific adapter by credential_id
Sourcepub async fn update_health(
&self,
credential_id: &str,
health: AdapterHealth,
reset_failures: bool,
)
pub async fn update_health( &self, credential_id: &str, health: AdapterHealth, reset_failures: bool, )
Update health state for a credential
Sourcepub async fn get_health(
&self,
credential_id: &str,
) -> Option<(AdapterHealth, u32)>
pub async fn get_health( &self, credential_id: &str, ) -> Option<(AdapterHealth, u32)>
Get health state for a credential
Sourcepub async fn check_process_alive(&self, credential_id: &str) -> bool
pub async fn check_process_alive(&self, credential_id: &str) -> bool
Check if adapter process has exited
Sourcepub async fn get_all_health(
&self,
) -> HashMap<String, (String, AdapterHealth, u32)>
pub async fn get_all_health( &self, ) -> HashMap<String, (String, AdapterHealth, u32)>
Get all credentials with their health status
Sourcepub async fn restart(
&self,
credential_id: &str,
max_restarts: u32,
) -> Result<bool, AppError>
pub async fn restart( &self, credential_id: &str, max_restarts: u32, ) -> Result<bool, AppError>
Restart an adapter process Returns Ok(true) if restart succeeded, Ok(false) if should wait (backoff), Err on failure
Sourcepub async fn reset_restart_count(&self, credential_id: &str)
pub async fn reset_restart_count(&self, credential_id: &str)
Reset restart count for a credential (called when adapter is healthy for a while)
Auto Trait Implementations§
impl !Freeze for AdapterInstanceManager
impl !RefUnwindSafe for AdapterInstanceManager
impl Send for AdapterInstanceManager
impl Sync for AdapterInstanceManager
impl Unpin for AdapterInstanceManager
impl UnsafeUnpin for AdapterInstanceManager
impl !UnwindSafe for AdapterInstanceManager
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
Mutably borrows from an owned value. Read more