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 fn canceled(&self) -> impl Future<Output = ()> + Send
pub fn reset_canceled(&mut self)
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.
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.
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 !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<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> 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
.