pub struct Session {Show 26 fields
pub in_transaction: bool,
pub shard_sessions: Vec<ShardSession>,
pub autocommit: bool,
pub target_string: String,
pub options: Option<ExecuteOptions>,
pub transaction_mode: i32,
pub warnings: Vec<QueryWarning>,
pub pre_sessions: Vec<ShardSession>,
pub post_sessions: Vec<ShardSession>,
pub last_insert_id: u64,
pub found_rows: u64,
pub user_defined_variables: HashMap<String, BindVariable>,
pub system_variables: HashMap<String, String>,
pub row_count: i64,
pub savepoints: Vec<String>,
pub in_reserved_conn: bool,
pub lock_session: Option<ShardSession>,
pub last_lock_heartbeat: i64,
pub read_after_write: Option<ReadAfterWrite>,
pub ddl_strategy: String,
pub session_uuid: String,
pub enable_system_settings: bool,
pub advisory_lock: HashMap<String, i64>,
pub query_timeout: i64,
pub prepare_statement: HashMap<String, PrepareData>,
pub migration_context: String,
}Expand description
Session objects are exchanged like cookies through various calls to VTGate. The behavior differs between V2 & V3 APIs. V3 APIs are Execute, ExecuteBatch and StreamExecute. All other APIs are V2. For the V3 APIs, the session must be sent with every call to Execute or ExecuteBatch. For the V2 APIs, Begin does not accept a session. It instead returns a brand new one with in_transaction set to true. After a call to Commit or Rollback, the session can be discarded. If you’re not in a transaction, Session is an optional parameter for the V2 APIs.
Fields§
§in_transaction: boolin_transaction is set to true if the session is in a transaction.
shard_sessions: Vec<ShardSession>shard_sessions keep track of per-shard transaction info.
autocommit: boolautocommit specifies if the session is in autocommit mode. This is used only for V3.
target_string: Stringtarget_string is the target expressed as a string. Valid names are: keyspace:shard@target, keyspace@target or @target. This is used only for V3.
options: Option<ExecuteOptions>options is used only for V3.
transaction_mode: i32transaction_mode specifies the current transaction mode.
warnings: Vec<QueryWarning>warnings contains non-fatal warnings from the previous query
pre_sessions: Vec<ShardSession>pre_sessions contains sessions that have to be committed first.
post_sessions: Vec<ShardSession>post_sessions contains sessions that have to be committed last.
last_insert_id: u64last_insert_id keeps track of the last seen insert_id for this session
found_rows: u64found_rows keeps track of how many rows the last query returned
user_defined_variables: HashMap<String, BindVariable>user_defined_variables contains all the @variables defined for this session
system_variables: HashMap<String, String>system_variables keeps track of all session variables set for this connection TODO: systay should we keep this so we can apply it ordered?
row_count: i64row_count keeps track of the last seen rows affected for this session
savepoints: Vec<String>Stores savepoint and release savepoint calls inside a transaction and is reset once transaction is committed or rolled back.
in_reserved_conn: boolin_reserved_conn is set to true if the session should be using reserved connections.
lock_session: Option<ShardSession>lock_session keep tracks of shard on which the lock query is sent.
last_lock_heartbeat: i64last_lock_heartbeat keep tracks of when last lock heartbeat was sent.
read_after_write: Option<ReadAfterWrite>read_after_write tracks the ReadAfterWrite settings for this session.
ddl_strategy: StringDDL strategy
session_uuid: StringSession UUID
enable_system_settings: boolenable_system_settings defines if we can use reserved connections.
advisory_lock: HashMap<String, i64>§query_timeout: i64query_timeout is the maximum amount of time a query is permitted to run
prepare_statement: HashMap<String, PrepareData>§migration_context: StringMigrationContext
Implementations§
Source§impl Session
impl Session
Sourcepub fn transaction_mode(&self) -> TransactionMode
pub fn transaction_mode(&self) -> TransactionMode
Returns the enum value of transaction_mode, or the default if the field is set to an invalid enum value.
Sourcepub fn set_transaction_mode(&mut self, value: TransactionMode)
pub fn set_transaction_mode(&mut self, value: TransactionMode)
Sets transaction_mode to the provided enum value.
Trait Implementations§
Source§impl Message for Session
impl Message for Session
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self.impl StructuralPartialEq for Session
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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