pub struct StreamSession { /* private fields */ }Expand description
StreamSession aggregate root - manages multiple prioritized streams
Implementations§
Source§impl StreamSession
impl StreamSession
Sourcepub fn new(config: SessionConfig) -> Self
pub fn new(config: SessionConfig) -> Self
Create new session
Sourcepub fn state(&self) -> &SessionState
pub fn state(&self) -> &SessionState
Get current state
Sourcepub fn config(&self) -> &SessionConfig
pub fn config(&self) -> &SessionConfig
Get configuration
Sourcepub fn stats(&self) -> &SessionStats
pub fn stats(&self) -> &SessionStats
Get statistics
Sourcepub fn created_at(&self) -> DateTime<Utc>
pub fn created_at(&self) -> DateTime<Utc>
Get creation timestamp
Sourcepub fn updated_at(&self) -> DateTime<Utc>
pub fn updated_at(&self) -> DateTime<Utc>
Get last update timestamp
Sourcepub fn expires_at(&self) -> DateTime<Utc>
pub fn expires_at(&self) -> DateTime<Utc>
Get expiration timestamp
Sourcepub fn completed_at(&self) -> Option<DateTime<Utc>>
pub fn completed_at(&self) -> Option<DateTime<Utc>>
Get completion timestamp
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if session is expired
Sourcepub fn get_stream(&self, stream_id: StreamId) -> Option<&Stream>
pub fn get_stream(&self, stream_id: StreamId) -> Option<&Stream>
Get stream by ID
Sourcepub fn get_stream_mut(&mut self, stream_id: StreamId) -> Option<&mut Stream>
pub fn get_stream_mut(&mut self, stream_id: StreamId) -> Option<&mut Stream>
Get mutable stream by ID
Sourcepub fn activate(&mut self) -> DomainResult<()>
pub fn activate(&mut self) -> DomainResult<()>
Activate session
Sourcepub fn create_stream(&mut self, source_data: JsonData) -> DomainResult<StreamId>
pub fn create_stream(&mut self, source_data: JsonData) -> DomainResult<StreamId>
Create new stream in this session
Sourcepub fn start_stream(&mut self, stream_id: StreamId) -> DomainResult<()>
pub fn start_stream(&mut self, stream_id: StreamId) -> DomainResult<()>
Start streaming for a specific stream
Sourcepub fn complete_stream(&mut self, stream_id: StreamId) -> DomainResult<()>
pub fn complete_stream(&mut self, stream_id: StreamId) -> DomainResult<()>
Complete a specific stream
Sourcepub fn fail_stream(
&mut self,
stream_id: StreamId,
error: String,
) -> DomainResult<()>
pub fn fail_stream( &mut self, stream_id: StreamId, error: String, ) -> DomainResult<()>
Fail a specific stream
Sourcepub fn create_priority_frames(
&mut self,
batch_size: usize,
) -> DomainResult<Vec<Frame>>
pub fn create_priority_frames( &mut self, batch_size: usize, ) -> DomainResult<Vec<Frame>>
Create frames for all active streams based on priority
Sourcepub fn close(&mut self) -> DomainResult<()>
pub fn close(&mut self) -> DomainResult<()>
Close session gracefully
Sourcepub fn force_close_expired(&mut self) -> DomainResult<bool>
pub fn force_close_expired(&mut self) -> DomainResult<bool>
Force close expired session with proper cleanup
Sourcepub fn extend_timeout(&mut self, additional_seconds: u64) -> DomainResult<()>
pub fn extend_timeout(&mut self, additional_seconds: u64) -> DomainResult<()>
Extend session timeout (if allowed)
Sourcepub fn set_client_info(
&mut self,
client_info: String,
user_agent: Option<String>,
ip_address: Option<String>,
)
pub fn set_client_info( &mut self, client_info: String, user_agent: Option<String>, ip_address: Option<String>, )
Set client information
Sourcepub fn pending_events(&self) -> &VecDeque<DomainEvent>
pub fn pending_events(&self) -> &VecDeque<DomainEvent>
Get pending domain events
Sourcepub fn take_events(&mut self) -> VecDeque<DomainEvent>
pub fn take_events(&mut self) -> VecDeque<DomainEvent>
Take all pending events (clears the queue)
Sourcepub fn health_check(&self) -> SessionHealth
pub fn health_check(&self) -> SessionHealth
Check session health
Trait Implementations§
Source§impl Clone for StreamSession
impl Clone for StreamSession
Source§fn clone(&self) -> StreamSession
fn clone(&self) -> StreamSession
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 StreamSession
impl Debug for StreamSession
Source§impl<'de> Deserialize<'de> for StreamSession
impl<'de> Deserialize<'de> for StreamSession
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 StreamSession
impl RefUnwindSafe for StreamSession
impl Send for StreamSession
impl Sync for StreamSession
impl Unpin for StreamSession
impl UnwindSafe for StreamSession
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more