pub struct Pool { /* private fields */ }Expand description
http2连接池 连接池中的连接受max_conn数据限制 默认的keepalive是一分钟 连接池中的每个连接可并发流数受max_streams影响, 默认是20个 有三种行为会导致连接池中的连接被释放 1.对方主动关闭连接 2.remove_backend被调用清除后端地址, 这会导致该地址的所有连接失效 3.在外界没有引用sender达到keepalive时间后, 注意如果没有设置keepalive则此条无效
Implementations§
Trait Implementations§
Source§impl Pool for Pool
impl Pool for Pool
Source§fn set_max_conn(&self, max: Option<usize>)
fn set_max_conn(&self, max: Option<usize>)
设置最大连接数
Source§fn get_max_conn(&self) -> Option<usize>
fn get_max_conn(&self) -> Option<usize>
获取最大连接数
Source§fn get_cur_conn(&self) -> usize
fn get_cur_conn(&self) -> usize
获取当前的连接数
Source§fn set_keepalive(&self, duration: Option<Duration>)
fn set_keepalive(&self, duration: Option<Duration>)
设置空闲连接保留时长
Source§fn get_keepalive(&self) -> Option<Duration>
fn get_keepalive(&self) -> Option<Duration>
获取空闲连接保留时长
Source§fn get_strategy(&self) -> Arc<dyn Strategy>
fn get_strategy(&self) -> Arc<dyn Strategy>
获取转发策略
Source§fn remove_backend(&self, addr: &Address) -> bool
fn remove_backend(&self, addr: &Address) -> bool
移除一个后端地址
fn use_tls(&self, tls: bool)
fn tls(&self) -> bool
Source§fn get_backend(&self, key: &str) -> Option<BackendState>
fn get_backend(&self, key: &str) -> Option<BackendState>
根据策略获取一个后端
Source§fn get_backends(&self) -> Vec<BackendState>
fn get_backends(&self) -> Vec<BackendState>
获取所有后端地址切片
fn get_backend_by_id(&self, id: u32) -> Option<BackendState>
fn get_backend_by_code(&self, code: u64) -> Option<BackendState>
Auto Trait Implementations§
impl !Freeze for Pool
impl !RefUnwindSafe for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl !UnwindSafe for Pool
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