Skip to main content

AdapterInstanceManager

Struct AdapterInstanceManager 

Source
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: String

Adapters directory path

Implementations§

Source§

impl AdapterInstanceManager

Source

pub fn new( adapters_dir: String, port_range: (u16, u16), gateway_listen: &str, ) -> Result<Self, AppError>

Source

pub fn has_adapter(&self, name: &str) -> bool

Check if an adapter exists

Source

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

Source

pub async fn stop(&self, credential_id: &str) -> Result<(), AppError>

Stop an adapter process

Source

pub async fn get_port(&self, credential_id: &str) -> Option<u16>

Get the port for a credential’s adapter

Source

pub async fn get_instance_id(&self, credential_id: &str) -> Option<String>

Get instance_id for a credential

Source

pub async fn is_running(&self, credential_id: &str) -> bool

Check if adapter process is running for a credential

Source

pub async fn stop_all(&self)

Stop all adapter processes

Source

pub async fn get_credential_id(&self, instance_id: &str) -> Option<String>

Find credential_id by instance_id

Source

pub async fn check_health(&self, credential_id: &str) -> AdapterHealth

Check health of a specific adapter by credential_id

Source

pub async fn update_health( &self, credential_id: &str, health: AdapterHealth, reset_failures: bool, )

Update health state for a credential

Source

pub async fn get_health( &self, credential_id: &str, ) -> Option<(AdapterHealth, u32)>

Get health state for a credential

Source

pub async fn check_process_alive(&self, credential_id: &str) -> bool

Check if adapter process has exited

Source

pub async fn get_all_health( &self, ) -> HashMap<String, (String, AdapterHealth, u32)>

Get all credentials with their health status

Source

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

Source

pub async fn reset_restart_count(&self, credential_id: &str)

Reset restart count for a credential (called when adapter is healthy for a while)

Source

pub async fn get_restart_info( &self, credential_id: &str, ) -> Option<(u32, Option<Duration>)>

Get restart info for a credential

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,