Struct mz_coord::client::SessionClient
source · [−]pub struct SessionClient {
inner: ConnClient,
session: Option<Session>,
cancel_tx: Arc<Sender<Canceled>>,
cancel_rx: Receiver<Canceled>,
}
Expand description
A coordinator client that is bound to a connection.
See also Client
.
Fields
inner: ConnClient
session: Option<Session>
cancel_tx: Arc<Sender<Canceled>>
cancel_rx: Receiver<Canceled>
Implementations
sourceimpl 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, CoordError>
sourcepub async fn describe(
&mut self,
name: String,
stmt: Option<Statement<Raw>>,
param_types: Vec<Option<ScalarType>>
) -> Result<(), CoordError>
pub async fn describe(
&mut self,
name: String,
stmt: Option<Statement<Raw>>,
param_types: Vec<Option<ScalarType>>
) -> Result<(), CoordError>
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<(), CoordError>
pub async fn declare(
&mut self,
name: String,
stmt: Statement<Raw>,
param_types: Vec<Option<ScalarType>>
) -> Result<(), CoordError>
Binds a statement to a portal.
sourcepub async fn execute(
&mut self,
portal_name: String
) -> Result<ExecuteResponse, CoordError>
pub async fn execute(
&mut self,
portal_name: String
) -> Result<ExecuteResponse, CoordError>
Executes a previously-bound portal.
sourcepub async fn start_transaction(
&mut self,
implicit: Option<usize>
) -> Result<(), CoordError>
pub async fn start_transaction(
&mut self,
implicit: Option<usize>
) -> Result<(), CoordError>
Starts a transaction based on implicit:
None
: InTransactionSome(1)
: StartedSome(n > 1)
: InTransactionImplicitSome(0)
: no change
sourcepub async fn cancel_request(&mut self, conn_id: u32, secret_key: u32)
pub async fn cancel_request(&mut self, conn_id: u32, secret_key: u32)
Cancels the query currently running on another connection.
sourcepub async fn end_transaction(
&mut self,
action: EndTransactionAction
) -> Result<ExecuteResponse, CoordError>
pub async fn end_transaction(
&mut self,
action: EndTransactionAction
) -> Result<ExecuteResponse, CoordError>
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, CoordError>
pub async fn dump_catalog(&mut self) -> Result<String, CoordError>
Dumps the catalog to a JSON string.
sourcepub async fn insert_rows(
&mut self,
id: GlobalId,
columns: Vec<usize>,
rows: Vec<Row>
) -> Result<ExecuteResponse, CoordError>
pub async fn insert_rows(
&mut self,
id: GlobalId,
columns: Vec<usize>,
rows: Vec<Row>
) -> Result<ExecuteResponse, CoordError>
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 simple_execute(
&mut self,
stmts: &str
) -> Result<SimpleExecuteResponse, CoordError>
pub async fn simple_execute(
&mut self,
stmts: &str
) -> Result<SimpleExecuteResponse, CoordError>
Executes SQL statements using a simple protocol that does not involve portals.
The standard flow for executing a SQL statement requires parsing the
statement, binding it into a portal, and then executing that portal.
This function is a wrapper around that complexity with a simpler
interface. The provided stmts
are executed directly, and their results
are returned as a vector of rows, where each row is a vector of JSON
objects.
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.
async fn send<T, F>(&mut self, f: F) -> Result<T, CoordError> where
F: FnOnce(Sender<Response<T>>, Session) -> Command,
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto
.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto
.
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more