pub struct FtpConnectionPool { /* private fields */ }Expand description
Thread-safe FTP connection pool with LRU eviction
Implementations§
Source§impl FtpConnectionPool
impl FtpConnectionPool
Sourcepub fn new(max_connections: usize) -> Self
pub fn new(max_connections: usize) -> Self
Create a new connection pool with default configuration
Sourcepub fn with_config(config: PoolConfig) -> Self
pub fn with_config(config: PoolConfig) -> Self
Create a new connection pool with custom configuration
Sourcepub async fn get_connection(
&self,
host: &str,
port: u16,
username: &str,
password: &str,
mode: FtpMode,
) -> Result<PooledConnection>
pub async fn get_connection( &self, host: &str, port: u16, username: &str, password: &str, mode: FtpMode, ) -> Result<PooledConnection>
Get or create a connection from the pool
This method will:
- Try to find an existing healthy connection
- If found, mark it as used and return it
- If not found, create a new connection
- If pool is full, evict the least recently used connection
Sourcepub async fn return_connection(&self, conn: PooledConnection)
pub async fn return_connection(&self, conn: PooledConnection)
Return a connection to the pool for reuse
Sourcepub async fn cleanup_stale(&self)
pub async fn cleanup_stale(&self)
Clean up stale connections
Auto Trait Implementations§
impl !RefUnwindSafe for FtpConnectionPool
impl !UnwindSafe for FtpConnectionPool
impl Freeze for FtpConnectionPool
impl Send for FtpConnectionPool
impl Sync for FtpConnectionPool
impl Unpin for FtpConnectionPool
impl UnsafeUnpin for FtpConnectionPool
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