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.