pub struct ConnectionManager<T: ClientFormat> { /* private fields */ }Expand description
ConnectionManager is the underlying manager that bb8::Pool uses to manage connections.
Implementations§
Source§impl<T: ClientFormat> ConnectionManager<T>
impl<T: ClientFormat> ConnectionManager<T>
Sourcepub async fn try_new<A: Into<Destination>, S: Into<Settings>>(
destination: A,
options: ClientOptions,
settings: Option<S>,
span: Option<NonZeroU64>,
) -> Result<Self>
pub async fn try_new<A: Into<Destination>, S: Into<Settings>>( destination: A, options: ClientOptions, settings: Option<S>, span: Option<NonZeroU64>, ) -> Result<Self>
Creates a new connection manager for the pool.
This method builds a ConnectionManager that the pool will use to create
and manage connections to ClickHouse. Each connection will be built using
the provided destination, options, and settings.
§Arguments
destination- TheClickHouseserver address (host:port or socket address)options- Client configuration optionssettings- OptionalClickHousesettings to apply to all connectionsspan- Optional tracing span ID for distributed tracing
§Errors
Returns an error if the destination cannot be resolved or is invalid
Sourcepub async fn try_new_with_builder(builder: ClientBuilder) -> Result<Self>
pub async fn try_new_with_builder(builder: ClientBuilder) -> Result<Self>
Creates a new connection manager from an existing ClientBuilder.
This is an alternative constructor that allows you to pre-configure a
ClientBuilder with custom settings before creating the connection manager.
This is useful when you need fine-grained control over the client configuration.
Unlike Self::try_new, which creates a ClientBuilder internally,
this method accepts a pre-configured builder directly.
§Errors
Returns an error if the builder’s destination cannot be verified
Sourcepub fn with_check(self, check: bool) -> Self
pub fn with_check(self, check: bool) -> Self
Whether the underlying connection will issue a ping when checking health.
Sourcepub fn connection_identifier(&self) -> String
pub fn connection_identifier(&self) -> String
Useful to determine if 2 connections are essentially the same
Trait Implementations§
Source§impl<T: Clone + ClientFormat> Clone for ConnectionManager<T>
impl<T: Clone + ClientFormat> Clone for ConnectionManager<T>
Source§fn clone(&self) -> ConnectionManager<T>
fn clone(&self) -> ConnectionManager<T>
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: ClientFormat> ManageConnection for ConnectionManager<T>
impl<T: ClientFormat> ManageConnection for ConnectionManager<T>
Source§type Connection = Client<T>
type Connection = Client<T>
Source§async fn connect(&self) -> Result<Self::Connection, Self::Error>
async fn connect(&self) -> Result<Self::Connection, Self::Error>
Source§async fn is_valid(&self, conn: &mut Self::Connection) -> Result<(), Self::Error>
async fn is_valid(&self, conn: &mut Self::Connection) -> Result<(), Self::Error>
Source§fn has_broken(&self, conn: &mut Self::Connection) -> bool
fn has_broken(&self, conn: &mut Self::Connection) -> bool
Auto Trait Implementations§
impl<T> Freeze for ConnectionManager<T>
impl<T> !RefUnwindSafe for ConnectionManager<T>
impl<T> Send for ConnectionManager<T>
impl<T> Sync for ConnectionManager<T>
impl<T> Unpin for ConnectionManager<T>
impl<T> !UnwindSafe for ConnectionManager<T>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)