pub struct SessionLoopState { /* private fields */ }Expand description
Per-session loop-detection state. Embedding/delta mutation happens on
worker threads; the hot path reads SessionLoopState::state and
SessionLoopState::action, and calls SessionLoopState::reset when
an Inject verdict fires.
Implementations§
Source§impl SessionLoopState
impl SessionLoopState
Sourcepub fn new(cfg: BreakerConfig) -> Self
pub fn new(cfg: BreakerConfig) -> Self
Create with cfg.
Sourcepub fn state(&self) -> BreakerState
pub fn state(&self) -> BreakerState
Current breaker state (hot-path read).
Sourcepub fn action(&self) -> BreakerAction
pub fn action(&self) -> BreakerAction
Configured enforcement action when the breaker is open.
Sourcepub fn observe(
&self,
embedder: &dyn Embedder,
text: &str,
step_tokens: u64,
) -> BreakerVerdict
pub fn observe( &self, embedder: &dyn Embedder, text: &str, step_tokens: u64, ) -> BreakerVerdict
Observe one reasoning step (worker thread): embed, compute Δ against the previous step, update the streak, return the verdict.
Sourcepub fn observe_embedding(
&self,
embedding: Vec<f32>,
step_tokens: u64,
) -> BreakerVerdict
pub fn observe_embedding( &self, embedding: Vec<f32>, step_tokens: u64, ) -> BreakerVerdict
Observe a precomputed embedding. Workers use this path when the same vector is also persisted to an off-path vector sink.
Sourcepub fn observe_embedding_with_similarity(
&self,
embedding: Vec<f32>,
step_tokens: u64,
nearest_similarity: Option<f32>,
) -> BreakerVerdict
pub fn observe_embedding_with_similarity( &self, embedding: Vec<f32>, step_tokens: u64, nearest_similarity: Option<f32>, ) -> BreakerVerdict
Observe an embedding plus an optional nearest prior-step similarity (scoped to the same session) supplied by a distributed vector engine.
Auto Trait Implementations§
impl !Freeze for SessionLoopState
impl !RefUnwindSafe for SessionLoopState
impl Send for SessionLoopState
impl Sync for SessionLoopState
impl Unpin for SessionLoopState
impl UnsafeUnpin for SessionLoopState
impl UnwindSafe for SessionLoopState
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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