pub struct ClientPool {
pub storages: HashMap<BlockChainType, Box<dyn Any + Send + Sync>>,
}
Expand description
Main client pool manager that handles multiple blockchain types.
Provides type-safe access to cached blockchain clients. Clients are created on demand when first requested and then cached for future use. Uses RwLock for thread-safe access and Arc for shared ownership.
Fields§
§storages: HashMap<BlockChainType, Box<dyn Any + Send + Sync>>
Map of client storages indexed by client type
Implementations§
Source§impl ClientPool
impl ClientPool
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty client pool.
Initializes empty hashmaps for both EVM and Stellar clients.
Sourcepub async fn get_client_count<T: 'static>(
&self,
client_type: BlockChainType,
) -> usize
pub async fn get_client_count<T: 'static>( &self, client_type: BlockChainType, ) -> usize
Get the number of clients for a given client type.
Trait Implementations§
Source§impl ClientPoolTrait for ClientPool
impl ClientPoolTrait for ClientPool
Source§fn get_evm_client<'life0, 'life1, 'async_trait>(
&'life0 self,
network: &'life1 Network,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::EvmClient>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_evm_client<'life0, 'life1, 'async_trait>(
&'life0 self,
network: &'life1 Network,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::EvmClient>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets or creates an EVM client for the given network.
First checks the cache for an existing client. If none exists, creates a new client under a write lock.
Source§fn get_stellar_client<'life0, 'life1, 'async_trait>(
&'life0 self,
network: &'life1 Network,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::StellarClient>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_stellar_client<'life0, 'life1, 'async_trait>(
&'life0 self,
network: &'life1 Network,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::StellarClient>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets or creates a Stellar client for the given network.
First checks the cache for an existing client. If none exists, creates a new client under a write lock.
type EvmClient = EvmClient<EVMTransportClient>
type StellarClient = StellarClient<StellarTransportClient>
Auto Trait Implementations§
impl Freeze for ClientPool
impl !RefUnwindSafe for ClientPool
impl Send for ClientPool
impl Sync for ClientPool
impl Unpin for ClientPool
impl !UnwindSafe for ClientPool
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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