pub struct SessionMemoryState { /* private fields */ }Expand description
Per-session memory-context state machine. All transitions are exhaustive over (current slot state, action); there are no boolean mode flags and no raw JSON past this boundary (spec §19).
Implementations§
Source§impl SessionMemoryState
impl SessionMemoryState
Sourcepub fn session_id(&self) -> &SessionId
pub fn session_id(&self) -> &SessionId
The session identity this state machine is scoped to.
Sourcepub fn active_mode(&self) -> MemoryContextMode
pub fn active_mode(&self) -> MemoryContextMode
The effective durable mode (Off when no session lease is installed).
Sourcepub fn install(
&mut self,
lease: MemoryContextLease,
) -> Result<(), MemoryContextError>
pub fn install( &mut self, lease: MemoryContextLease, ) -> Result<(), MemoryContextError>
Install a session lease (spec §19 Enable). Only session-lease modes
are installable here: Off is reached via Self::revoke and
RecallOnce via Self::install_one_shot — both rejections fail
closed. An already-active lease is replaced: each install carries its
own fresh user authorization proof.
Sourcepub fn install_one_shot(
&mut self,
lease: MemoryContextLease,
) -> Result<(), MemoryContextError>
pub fn install_one_shot( &mut self, lease: MemoryContextLease, ) -> Result<(), MemoryContextError>
Install a one-shot recall lease (spec §19 RecallOnce). Exactness
guarantees (spec §20.1):
- only one pending one-shot at a time (
OneShotAlreadyPending); - re-installing a consumed lease ID is rejected
(
OneShotAlreadyConsumed) so retries cannot recall twice; - a different lease ID after consumption is a fresh grant and installs normally.
Sourcepub fn consume_one_shot(
&mut self,
) -> Result<MemoryContextLease, MemoryContextError>
pub fn consume_one_shot( &mut self, ) -> Result<MemoryContextLease, MemoryContextError>
Consume the pending one-shot recall for an eligible prompt. Transitions
Pending → Consumed exactly once and returns the lease; every repeat
fails closed. An expired pending lease is dropped unused.
Sourcepub fn revoke(&mut self, session: &SessionId)
pub fn revoke(&mut self, session: &SessionId)
Immediately revoke this session’s memory context (spec §19 Disable).
A foreign session identity is a fail-closed no-op. The Consumed
replay marker survives revocation: disabling memory must not re-arm a
consumed logical request; a genuinely new grant uses a fresh lease ID.
Sourcepub fn status(&self) -> MemoryContextStatus
pub fn status(&self) -> MemoryContextStatus
Typed status snapshot — safe to surface without spawning any provider process (spec §7.2 “status does not spawn”).
Trait Implementations§
Source§impl Clone for SessionMemoryState
impl Clone for SessionMemoryState
Source§fn clone(&self) -> SessionMemoryState
fn clone(&self) -> SessionMemoryState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SessionMemoryState
impl Debug for SessionMemoryState
impl Eq for SessionMemoryState
Source§impl PartialEq for SessionMemoryState
impl PartialEq for SessionMemoryState
impl StructuralPartialEq for SessionMemoryState
Auto Trait Implementations§
impl Freeze for SessionMemoryState
impl RefUnwindSafe for SessionMemoryState
impl Send for SessionMemoryState
impl Sync for SessionMemoryState
impl Unpin for SessionMemoryState
impl UnsafeUnpin for SessionMemoryState
impl UnwindSafe for SessionMemoryState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.