Struct coord::client::SessionClient [−][src]
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.
You must call SessionClient::terminate
rather than dropping a session
client directly. Dropping an unterminated SessionClient
will panic.
See also Client
.
Fields
inner: ConnClient
session: Option<Session>
cancel_tx: Arc<Sender<Canceled>>
cancel_rx: Receiver<Canceled>
Implementations
pub async fn get_prepared_statement(
&mut self,
name: &str
) -> Result<&PreparedStatement, 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.
Binds a statement to a portal.
Executes a previously-bound portal.
Starts a transaction based on implicit:
None
: InTransactionSome(1)
: StartedSome(n > 1)
: InTransactionImplicitSome(0)
: no change
Cancels the query currently running on another connection.
pub 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.
Fails a transaction.
Dumps the catalog to a JSON string.
pub 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.
pub 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.
Terminates this client session.
This method cleans up any coordinator state associated with the session before consuming the `SessionClient. Call this method instead of dropping the object directly.
Returns a mutable reference to the session bound to this client.
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
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more