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

source

pub fn canceled(&self) -> impl Future<Output = ()> + Send

source

pub fn reset_canceled(&mut self)

source

pub async fn get_prepared_statement( &mut self, name: &str ) -> Result<&PreparedStatement, AdapterError>

source

pub async fn prepare( &mut self, name: String, stmt: Option<Statement<Raw>>, 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.

source

pub async fn declare( &mut self, name: String, stmt: Statement<Raw>, param_types: Vec<Option<ScalarType>> ) -> Result<(), AdapterError>

Binds a statement to a portal.

source

pub async fn execute( &mut self, portal_name: String, cancel_future: impl Future<Output = Error> + Send ) -> Result<ExecuteResponse, AdapterError>

Executes a previously-bound portal.

source

fn now(&self) -> EpochMillis

source

fn now_datetime(&self) -> DateTime<Utc>

source

pub fn start_transaction( &mut self, implicit: Option<usize> ) -> Result<(), AdapterError>

Starts a transaction based on implicit:

  • None: InTransaction
  • Some(1): Started
  • Some(n > 1): InTransactionImplicit
  • Some(0): no change
source

pub async fn end_transaction( &mut self, action: EndTransactionAction ) -> Result<ExecuteResponse, AdapterError>

Ends a transaction.

source

pub fn fail_transaction(&mut self)

Fails a transaction.

source

pub async fn dump_catalog(&mut self) -> Result<CatalogDump, AdapterError>

Dumps the catalog to a JSON string.

source

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.

source

pub async fn get_system_vars( &mut self ) -> Result<GetVariablesResponse, AdapterError>

Gets the current value of all system variables.

source

pub async fn set_system_vars( &mut self, vars: BTreeMap<String, String> ) -> Result<(), AdapterError>

Updates the specified system variables to the specified values.

source

pub async fn terminate(&mut self)

Terminates the client session.

source

pub fn session(&mut self) -> &mut Session

Returns a mutable reference to the session bound to this client.

source

pub fn inner(&self) -> &ConnClient

Returns a reference to the inner client.

source

pub fn inner_mut(&mut self) -> &mut ConnClient

Returns a mutable reference to the inner client.

source

async fn send<T, F>(&mut self, f: F) -> Result<T, AdapterError>where F: FnOnce(Sender<Response<T>>, Session) -> Command,

source

async fn send_with_cancel<T, F>( &mut self, f: F, cancel_future: impl Future<Output = Error> + Send ) -> Result<T, AdapterError>where F: FnOnce(Sender<Response<T>>, Session) -> Command,

source

pub fn add_idle_in_transaction_session_timeout(&mut self)

source

pub fn remove_idle_in_transaction_session_timeout(&mut self)

source

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§

source§

impl Drop for SessionClient

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Pointable for T

source§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<P, R> ProtoType<R> for Pwhere R: RustType<P>,

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more