pub struct Session {
pub session_id: SessionId,
pub principal: AuthenticatedIdentity,
pub current_database: DatabaseId,
pub transaction_state: TransactionState,
pub prepared_statements: BTreeMap<StatementId, PreparedStatementBinding>,
pub settings: BTreeMap<String, String>,
pub read_your_writes_token: Option<HlcTimestamp>,
pub last_activity_unix_micros: u64,
}Expand description
The server-side state of one client session (S1D-004).
Data only: a session owns no storage, no executor state, and no admission slots — it is the lightweight record those subsystems key off.
Fields§
§session_id: SessionIdServer-allocated identifier of this session.
principal: AuthenticatedIdentityAuthenticated identity the session acts as; fixed at session open.
current_database: DatabaseIdDatabase the session’s statements resolve against.
transaction_state: TransactionStateActive transaction, if any.
prepared_statements: BTreeMap<StatementId, PreparedStatementBinding>Prepared statements live on this session, by handle.
settings: BTreeMap<String, String>Session settings (e.g. timezone, statement_timeout); keys and
values are adapter-defined, unknown keys are ignored by the server.
read_your_writes_token: Option<HlcTimestamp>Read-your-writes token: the highest commit timestamp this session has durably observed; subsequent reads wait for visibility up to it.
last_activity_unix_micros: u64Last activity, wall-clock microseconds since the Unix epoch (same
time base as crate::request::ExecuteRequest::deadline_unix_micros);
idle reaping (S1D-007) keys off this.
Implementations§
Source§impl Session
impl Session
Sourcepub fn new(
session_id: SessionId,
principal: AuthenticatedIdentity,
current_database: DatabaseId,
now_unix_micros: u64,
) -> Self
pub fn new( session_id: SessionId, principal: AuthenticatedIdentity, current_database: DatabaseId, now_unix_micros: u64, ) -> Self
Opens a fresh session: no active transaction, no prepared statements, default settings, no read-your-writes token yet.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 UnsafeUnpin 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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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