Struct mz_adapter::client::SessionClient
source · pub struct SessionClient { /* private fields */ }
Expand description
A coordinator client that is bound to a connection.
See also Client
.
Implementations§
source§impl SessionClient
impl SessionClient
sourcepub fn parse<'a>(
&self,
sql: &'a str
) -> Result<Result<Vec<StatementParseResult<'a>>, ParserStatementError>, String>
pub fn parse<'a>( &self, sql: &'a str ) -> Result<Result<Vec<StatementParseResult<'a>>, ParserStatementError>, String>
Parses a SQL expression, reporting failures as a telemetry event if possible.
pub async fn get_prepared_statement( &mut self, name: &str ) -> Result<&PreparedStatement, AdapterError>
sourcepub async fn prepare(
&mut self,
name: String,
stmt: Option<Statement<Raw>>,
sql: String,
param_types: Vec<Option<ScalarType>>
) -> Result<(), AdapterError>
pub async fn prepare( &mut self, name: String, stmt: Option<Statement<Raw>>, sql: String, param_types: Vec<Option<ScalarType>> ) -> Result<(), AdapterError>
Saves the parsed statement as a prepared statement.
The prepared statement is saved in the connection’s crate::session::Session
under the specified name.
sourcepub async fn declare(
&mut self,
name: String,
stmt: Statement<Raw>,
sql: String
) -> Result<(), AdapterError>
pub async fn declare( &mut self, name: String, stmt: Statement<Raw>, sql: String ) -> Result<(), AdapterError>
Binds a statement to a portal.
sourcepub async fn execute(
&mut self,
portal_name: String,
cancel_future: impl Future<Output = Error> + Send,
outer_ctx_extra: Option<ExecuteContextExtra>
) -> Result<(ExecuteResponse, Instant), AdapterError>
pub async fn execute( &mut self, portal_name: String, cancel_future: impl Future<Output = Error> + Send, outer_ctx_extra: Option<ExecuteContextExtra> ) -> Result<(ExecuteResponse, Instant), AdapterError>
Executes a previously-bound portal.
Note: the provided cancel_future
must be cancel-safe as it’s polled in a select!
loop.
sourcepub fn start_transaction(
&mut self,
implicit: Option<usize>
) -> Result<(), AdapterError>
pub fn start_transaction( &mut self, implicit: Option<usize> ) -> Result<(), AdapterError>
Starts a transaction based on implicit:
None
: InTransactionSome(1)
: StartedSome(n > 1)
: InTransactionImplicitSome(0)
: no change
sourcepub async fn end_transaction(
&mut self,
action: EndTransactionAction
) -> Result<ExecuteResponse, AdapterError>
pub async fn end_transaction( &mut self, action: EndTransactionAction ) -> Result<ExecuteResponse, AdapterError>
Ends a transaction.
sourcepub fn fail_transaction(&mut self)
pub fn fail_transaction(&mut self)
Fails a transaction.
sourcepub async fn catalog_snapshot(&self) -> Arc<Catalog>
pub async fn catalog_snapshot(&self) -> Arc<Catalog>
Fetches the catalog.
sourcepub async fn dump_catalog(&mut self) -> Result<CatalogDump, AdapterError>
pub async fn dump_catalog(&mut self) -> Result<CatalogDump, AdapterError>
Dumps the catalog to a JSON string.
No authorization is performed, so access to this function must be limited to internal servers or superusers.
sourcepub async fn check_catalog(&mut self) -> Result<(), Value>
pub async fn check_catalog(&mut self) -> Result<(), Value>
Checks the catalog for internal consistency, returning a JSON object describing the inconsistencies, if there are any.
No authorization is performed, so access to this function must be limited to internal servers or superusers.
sourcepub async fn check_coordinator(&mut self) -> Result<(), Value>
pub async fn check_coordinator(&mut self) -> Result<(), Value>
Checks the coordinator for internal consistency, returning a JSON object describing the inconsistencies, if there are any. This is a superset of checks that check_catalog performs,
No authorization is performed, so access to this function must be limited to internal servers or superusers.
pub async fn dump_coordinator_state(&mut self) -> Result<Value, Error>
sourcepub fn retire_execute(
&mut self,
data: ExecuteContextExtra,
reason: StatementEndedExecutionReason
)
pub fn retire_execute( &mut self, data: ExecuteContextExtra, reason: StatementEndedExecutionReason )
Tells the coordinator a statement has finished execution, in the cases where we have no other reason to communicate with the coordinator.
sourcepub async fn insert_rows(
&mut self,
id: GlobalId,
columns: Vec<usize>,
rows: Vec<Row>,
ctx_extra: ExecuteContextExtra
) -> Result<ExecuteResponse, AdapterError>
pub async fn insert_rows( &mut self, id: GlobalId, columns: Vec<usize>, rows: Vec<Row>, ctx_extra: ExecuteContextExtra ) -> Result<ExecuteResponse, AdapterError>
Inserts a set of rows into the given table.
The rows only contain the columns positions in columns
, so they
must be re-encoded for adding the default values for the remaining
ones.
sourcepub async fn get_system_vars(
&mut self
) -> Result<GetVariablesResponse, AdapterError>
pub async fn get_system_vars( &mut self ) -> Result<GetVariablesResponse, AdapterError>
Gets the current value of all system variables.
sourcepub async fn set_system_vars(
&mut self,
vars: BTreeMap<String, String>
) -> Result<(), AdapterError>
pub async fn set_system_vars( &mut self, vars: BTreeMap<String, String> ) -> Result<(), AdapterError>
Updates the specified system variables to the specified values.
sourcepub fn session(&mut self) -> &mut Session
pub fn session(&mut self) -> &mut Session
Returns a mutable reference to the session bound to this client.
pub fn add_idle_in_transaction_session_timeout(&mut self)
pub fn remove_idle_in_transaction_session_timeout(&mut self)
sourcepub async fn recv_timeout(&mut self) -> Option<TimeoutType>
pub async fn recv_timeout(&mut self) -> Option<TimeoutType>
§Cancel safety
This method is cancel safe. If recv
is used as the event in a
tokio::select!
statement and some other branch
completes first, it is guaranteed that no messages were received on this
channel.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionClient
impl !RefUnwindSafe for SessionClient
impl Send for SessionClient
impl Sync for SessionClient
impl Unpin for SessionClient
impl !UnwindSafe for SessionClient
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<R, O, T> CopyOnto<ConsecutiveOffsetPairs<R, O>> for T
impl<R, O, T> CopyOnto<ConsecutiveOffsetPairs<R, O>> for T
source§fn copy_onto(
self,
target: &mut ConsecutiveOffsetPairs<R, O>
) -> <ConsecutiveOffsetPairs<R, O> as Region>::Index
fn copy_onto( self, target: &mut ConsecutiveOffsetPairs<R, O> ) -> <ConsecutiveOffsetPairs<R, O> as Region>::Index
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<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.