pub struct SessionProjection {
pub session_key: SessionKey,
pub agent_id: String,
pub channel: ChannelId,
pub peer_id: String,
pub state: SessionState,
pub message_count: u64,
pub last_activity: DateTime<Utc>,
pub messages: Vec<SessionMessage>,
pub custom_state: HashMap<String, Value>,
pub last_event_id: Option<EventId>,
}Expand description
CRDT projection for session state.
This is a materialized view derived from applying events. Supports CRDT merge for conflict resolution.
Fields§
§session_key: SessionKeySession identifier.
agent_id: StringAgent ID.
channel: ChannelIdChannel.
peer_id: StringPeer ID.
state: SessionStateCurrent state.
message_count: u64Total message count.
last_activity: DateTime<Utc>Last activity timestamp.
messages: Vec<SessionMessage>Message history.
custom_state: HashMap<String, Value>Custom state key-value pairs.
last_event_id: Option<EventId>Last event ID applied.
Implementations§
Source§impl SessionProjection
impl SessionProjection
Sourcepub fn new(
session_key: SessionKey,
agent_id: String,
channel: ChannelId,
peer_id: String,
) -> Self
pub fn new( session_key: SessionKey, agent_id: String, channel: ChannelId, peer_id: String, ) -> Self
Create a new empty projection.
Sourcepub fn apply(&mut self, event: &SessionEvent)
pub fn apply(&mut self, event: &SessionEvent)
Apply an event to update the projection.
Trait Implementations§
Source§impl Clone for SessionProjection
impl Clone for SessionProjection
Source§fn clone(&self) -> SessionProjection
fn clone(&self) -> SessionProjection
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 SessionProjection
impl Debug for SessionProjection
Source§impl<'de> Deserialize<'de> for SessionProjection
impl<'de> Deserialize<'de> for SessionProjection
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 SessionProjection
impl RefUnwindSafe for SessionProjection
impl Send for SessionProjection
impl Sync for SessionProjection
impl Unpin for SessionProjection
impl UnwindSafe for SessionProjection
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