Expand description
Session Manager for automatic PQXDH state synchronization
This module provides a state synchronization layer that:
- Uses a builder pattern for initialization and state loading
- Manages PQXDH protocol handlers and their state changes
- Automatically persists state changes to storage transparently
- Returns clones of specific types when requested
- Emits state change events for reactive programming
The SessionManager acts as a central hub for PQXDH state management, providing:
- Automatic Persistence: State changes are immediately persisted to storage
- Event Broadcasting: State changes are broadcast to subscribers
- Handler Management: Registration and lifecycle management of PQXDH handlers
- State Access: Fast access to current states via cloning
§Usage Pattern
// Build the session manager (loads all states from storage)
let manager = SessionManager::builder(storage, messages_manager)
.build()
.await?;
// Register PQXDH handlers for automatic state listening
manager.register_pqxdh_handler("handler_1".to_string(), handler).await?;
// Get current state clones
let current_state = manager.get_pqxdh_state_clone("handler_1").await;
// Subscribe to state changes
let mut state_changes = manager.subscribe_to_state_changes();Structs§
- Session
Manager - State synchronization manager that automatically listens to and persists state changes.
- Session
Manager Builder - Builder for creating a SessionManager with proper initialization
Enums§
- Session
Manager Error - Errors that can occur during session management operations
Type Aliases§
- Pqxdh
Handler 🔒State - Pqxdh
Handler 🔒States - Session
Manager Result - Result type for session manager operations