pub struct InMemorySessions { /* private fields */ }Implementations§
Source§impl InMemorySessions
impl InMemorySessions
pub fn seed(&self, state: SessionState)
pub fn pending_of(&self, id: &SessionId) -> Vec<FactId>
Trait Implementations§
Source§impl Clone for InMemorySessions
impl Clone for InMemorySessions
Source§fn clone(&self) -> InMemorySessions
fn clone(&self) -> InMemorySessions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for InMemorySessions
impl Default for InMemorySessions
Source§fn default() -> InMemorySessions
fn default() -> InMemorySessions
Returns the “default value” for a type. Read more
Source§impl SessionRepository for InMemorySessions
impl SessionRepository for InMemorySessions
Source§async fn get_or_create(
&self,
id: &SessionId,
memory_key: &MemoryKey,
) -> Result<SessionState, RepoError>
async fn get_or_create( &self, id: &SessionId, memory_key: &MemoryKey, ) -> Result<SessionState, RepoError>
Fetch a session by id, creating it if absent (POC
get_or_create).Source§async fn collect_expired(
&self,
_timeout: Duration,
) -> Result<Vec<(SessionId, SessionState)>, RepoError>
async fn collect_expired( &self, _timeout: Duration, ) -> Result<Vec<(SessionId, SessionState)>, RepoError>
Return and remove sessions inactive for longer than
timeout
(POC collect_expired). Pairs (id, state) are returned so the caller
can drain pending facts before the state is forgotten.Source§async fn snapshot_all(
&self,
) -> Result<Vec<(SessionId, SessionState)>, RepoError>
async fn snapshot_all( &self, ) -> Result<Vec<(SessionId, SessionState)>, RepoError>
Read-only snapshot of every session (POC
snapshot_all).Source§async fn add_pending(
&self,
id: &SessionId,
fact_ids: &[FactId],
) -> Result<(), RepoError>
async fn add_pending( &self, id: &SessionId, fact_ids: &[FactId], ) -> Result<(), RepoError>
Append fact ids to the pending list (deduplicating in place).
Source§async fn remove_pending_owned(
&self,
id: &SessionId,
owned: &[FactId],
) -> Result<(), RepoError>
async fn remove_pending_owned( &self, id: &SessionId, owned: &[FactId], ) -> Result<(), RepoError>
Remove only the supplied ids, preserving any concurrent additions
(parity with
SessionState::remove_owned).Source§async fn clear_session(&self, id: &SessionId) -> Result<(), RepoError>
async fn clear_session(&self, id: &SessionId) -> Result<(), RepoError>
Drop the session entirely.
Auto Trait Implementations§
impl Freeze for InMemorySessions
impl RefUnwindSafe for InMemorySessions
impl Send for InMemorySessions
impl Sync for InMemorySessions
impl Unpin for InMemorySessions
impl UnsafeUnpin for InMemorySessions
impl UnwindSafe for InMemorySessions
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