pub struct SessionContext {
pub session_id: String,
pub caller: CallerIdentity,
pub created_at: u64,
pub expires_at: Option<u64>,
pub request_count: u64,
pub bytes_read: u64,
pub bytes_written: u64,
pub delegation_depth: u32,
pub metadata: Option<Value>,
}Expand description
Per-session context carried through the Chio HTTP pipeline. A session groups related requests from the same caller over a bounded time window.
Fields§
§session_id: StringUnique session identifier.
caller: CallerIdentityThe authenticated caller for this session.
created_at: u64Unix timestamp (seconds) when the session was created.
expires_at: Option<u64>Unix timestamp (seconds) when the session expires. Guards may deny requests after this time.
request_count: u64Number of requests evaluated in this session so far.
bytes_read: u64Cumulative bytes read by this session (for data-flow guards).
bytes_written: u64Cumulative bytes written by this session (for data-flow guards).
delegation_depth: u32Current delegation depth (0 = direct caller).
metadata: Option<Value>Optional metadata for extensibility.
Implementations§
Source§impl SessionContext
impl SessionContext
Sourcepub fn new(session_id: String, caller: CallerIdentity) -> Self
pub fn new(session_id: String, caller: CallerIdentity) -> Self
Create a new session with the given ID and caller.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Whether this session has expired.
Trait Implementations§
Source§impl Clone for SessionContext
impl Clone for SessionContext
Source§fn clone(&self) -> SessionContext
fn clone(&self) -> SessionContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionContext
impl Debug for SessionContext
Source§impl<'de> Deserialize<'de> for SessionContext
impl<'de> Deserialize<'de> for SessionContext
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SessionContext
impl RefUnwindSafe for SessionContext
impl Send for SessionContext
impl Sync for SessionContext
impl Unpin for SessionContext
impl UnsafeUnpin for SessionContext
impl UnwindSafe for SessionContext
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
Mutably borrows from an owned value. Read more