Struct mz_environmentd::test_util::ConnectBuilder
source · pub struct ConnectBuilder<'s, T, H> {
server: &'s TestServer,
pg_config: Config,
port: u16,
tls: T,
notice_callback: Option<Box<dyn FnMut(DbError) + Send + 'static>>,
_with_handle: H,
}
Expand description
A builder struct to configure a pgwire connection to a running TestServer
.
You can create this struct, and thus open a pgwire connection, using TestServer::connect
.
Fields§
§server: &'s TestServer
A running environmentd
test server.
pg_config: Config
Postgres configuration for connecting to the test server.
port: u16
Port to use when connecting to the test server.
tls: T
Tls settings to use.
notice_callback: Option<Box<dyn FnMut(DbError) + Send + 'static>>
Callback that gets invoked for every notice we receive.
_with_handle: H
Type variable for whether or not we include the handle for the spawned tokio::task
.
Implementations§
source§impl<'s> ConnectBuilder<'s, (), NoHandle>
impl<'s> ConnectBuilder<'s, (), NoHandle>
fn new(server: &'s TestServer) -> Self
source§impl<'s, T, H> ConnectBuilder<'s, T, H>
impl<'s, T, H> ConnectBuilder<'s, T, H>
sourcepub fn no_tls(self) -> ConnectBuilder<'s, NoTls, H>
pub fn no_tls(self) -> ConnectBuilder<'s, NoTls, H>
Create a pgwire connection without using TLS.
Note: this is the default for all connections.
sourcepub fn with_tls<Tls>(self, tls: Tls) -> ConnectBuilder<'s, Tls, H>where
Tls: MakeTlsConnect<Socket> + Send + 'static,
Tls::TlsConnect: Send,
Tls::Stream: Send,
<Tls::TlsConnect as TlsConnect<Socket>>::Future: Send,
pub fn with_tls<Tls>(self, tls: Tls) -> ConnectBuilder<'s, Tls, H>where
Tls: MakeTlsConnect<Socket> + Send + 'static,
Tls::TlsConnect: Send,
Tls::Stream: Send,
<Tls::TlsConnect as TlsConnect<Socket>>::Future: Send,
Create a pgwire connection with TLS.
sourcepub fn with_config(self, pg_config: Config) -> Self
pub fn with_config(self, pg_config: Config) -> Self
Create a ConnectBuilder
using the provided tokio_postgres::Config
.
sourcepub fn ssl_mode(self, mode: SslMode) -> Self
pub fn ssl_mode(self, mode: SslMode) -> Self
Set the SslMode
to be used with the resulting connection.
sourcepub fn application_name(self, application_name: &str) -> Self
pub fn application_name(self, application_name: &str) -> Self
Set the application name for the pgwire connection.
sourcepub fn internal(self) -> Self
pub fn internal(self) -> Self
Configures this ConnectBuilder
to connect to the internal SQL port of the running
TestServer
.
For example, this will change the port we connect to, and the user we connect as.
sourcepub fn balancer(self) -> Self
pub fn balancer(self) -> Self
Configures this ConnectBuilder
to connect to the balancer SQL port of the running
TestServer
.
For example, this will change the port we connect to, and the user we connect as.
sourcepub fn notice_callback(
self,
callback: impl FnMut(DbError) + Send + 'static,
) -> Self
pub fn notice_callback( self, callback: impl FnMut(DbError) + Send + 'static, ) -> Self
Sets a callback for any database notices that are received from the TestServer
.
sourcepub fn with_handle(self) -> ConnectBuilder<'s, T, WithHandle>
pub fn with_handle(self) -> ConnectBuilder<'s, T, WithHandle>
Configures this ConnectBuilder
to return the mz_ore::task::JoinHandle
that is
polling the underlying postgres connection, associated with the returned client.
sourcepub fn as_pg_config(&self) -> &Config
pub fn as_pg_config(&self) -> &Config
Returns the tokio_postgres::Config
that will be used to connect.
Trait Implementations§
source§impl<'s, T, H> IntoFuture for ConnectBuilder<'s, T, H>where
T: MakeTlsConnect<Socket> + Send + 'static,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
H: IncludeHandle,
impl<'s, T, H> IntoFuture for ConnectBuilder<'s, T, H>where
T: MakeTlsConnect<Socket> + Send + 'static,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
H: IncludeHandle,
§type Output = Result<<H as IncludeHandle>::Output, Error>
type Output = Result<<H as IncludeHandle>::Output, Error>
§type IntoFuture = Pin<Box<dyn Future<Output = <ConnectBuilder<'s, T, H> as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <ConnectBuilder<'s, T, H> as IntoFuture>::Output> + Send>>
source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Auto Trait Implementations§
impl<'s, T, H> Freeze for ConnectBuilder<'s, T, H>
impl<'s, T, H> !RefUnwindSafe for ConnectBuilder<'s, T, H>
impl<'s, T, H> Send for ConnectBuilder<'s, T, H>
impl<'s, T, H> !Sync for ConnectBuilder<'s, T, H>
impl<'s, T, H> Unpin for ConnectBuilder<'s, T, H>
impl<'s, T, H> !UnwindSafe for ConnectBuilder<'s, T, H>
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
source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.