Struct mz_adapter::client::SessionClient
source · pub struct SessionClient {
inner: Option<ConnClient>,
session: Option<Session>,
cancel_tx: Arc<Sender<Canceled>>,
cancel_rx: Receiver<Canceled>,
timeouts: Timeout,
}
Expand description
A coordinator client that is bound to a connection.
See also Client
.
Fields§
§inner: Option<ConnClient>
§session: Option<Session>
§cancel_tx: Arc<Sender<Canceled>>
§cancel_rx: Receiver<Canceled>
§timeouts: Timeout
Implementations§
source§impl SessionClient
impl SessionClient
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 describe(
&mut self,
name: String,
stmt: Option<Statement<Raw>>,
param_types: Vec<Option<ScalarType>>
) -> Result<(), AdapterError>
pub async fn describe(
&mut self,
name: String,
stmt: Option<Statement<Raw>>,
param_types: Vec<Option<ScalarType>>
) -> Result<(), AdapterError>
Saves the specified 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>,
param_types: Vec<Option<ScalarType>>
) -> Result<(), AdapterError>
pub async fn declare(
&mut self,
name: String,
stmt: Statement<Raw>,
param_types: Vec<Option<ScalarType>>
) -> Result<(), AdapterError>
Binds a statement to a portal.
sourcepub async fn execute(
&mut self,
portal_name: String
) -> Result<ExecuteResponse, AdapterError>
pub async fn execute(
&mut self,
portal_name: String
) -> Result<ExecuteResponse, AdapterError>
Executes a previously-bound portal.
sourcepub async fn start_transaction(
&mut self,
implicit: Option<usize>
) -> Result<(), AdapterError>
pub async 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 fn cancel_request(&mut self, conn_id: ConnectionId, secret_key: u32)
pub fn cancel_request(&mut self, conn_id: ConnectionId, secret_key: u32)
Cancels the query currently running on another connection.
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 dump_catalog(&mut self) -> Result<String, AdapterError>
pub async fn dump_catalog(&mut self) -> Result<String, AdapterError>
Dumps the catalog to a JSON string.
sourcepub async fn insert_rows(
&mut self,
id: GlobalId,
columns: Vec<usize>,
rows: Vec<Row>
) -> Result<ExecuteResponse, AdapterError>
pub async fn insert_rows(
&mut self,
id: GlobalId,
columns: Vec<usize>,
rows: Vec<Row>
) -> 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 fn session(&mut self) -> &mut Session
pub fn session(&mut self) -> &mut Session
Returns a mutable reference to the session bound to this client.
sourcepub fn inner(&mut self) -> &mut ConnClient
pub fn inner(&mut self) -> &mut ConnClient
Returns a mutable reference to the inner client.
async fn send<T, F>(&mut self, f: F) -> Result<T, AdapterError>where
F: FnOnce(Sender<Response<T>>, Session) -> Command,
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> 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
.