Skip to main content

ExperienceStore

Struct ExperienceStore 

Source
pub struct ExperienceStore { /* private fields */ }
Expand description

Replayable, target-scoped outcome experience.

Observation order is represented by a monotonic integer rather than wall clock time. Recording an identical outcome is idempotent. Passive inconclusive results do not count as completed attempts; a later active result for the same case replaces them during assessment.

This store is action-outcome learning history. It does not receive or preserve crate::VerificationCase transition authorization, so an ExperienceDisposition::ConfirmedPositive is not evidence that a hypothesis state changed. The KnowledgeBase and complete VerificationReport remain authoritative for hypothesis state and transition audit.

§Example

use termivar_scanner::{ExperiencePolicy, ExperienceStore};

let store = ExperienceStore::new();
assert_eq!(store.len(), 0);
assert_eq!(ExperiencePolicy::default().consecutive_failure_limit(), 10);

Implementations§

Source§

impl ExperienceStore

Source

pub fn new() -> Self

Creates an empty store.

Source

pub fn observe( &mut self, outcome: Outcome, ) -> Result<ExperienceWrite, ExperienceStoreError>

Records one immutable outcome in deterministic call order.

Source

pub fn observe_with_disposition( &mut self, outcome: Outcome, disposition: ExperienceDisposition, ) -> Result<ExperienceWrite, ExperienceStoreError>

Records an outcome with an explicit, status-compatible disposition.

Callers should use this only when structured policy or an audited verifier can distinguish the conservative classification produced by Self::observe. Operational failures should not be converted into a synthetic successful or negative verifier result.

Source

pub fn len(&self) -> usize

Returns the number of unique stage outcomes.

Source

pub fn is_empty(&self) -> bool

Returns whether no outcomes have been observed.

Source

pub fn records(&self) -> &[ExperienceRecord]

Returns all records in stable global observation order.

Source

pub fn history<'a>( &'a self, subject: &'a EntityId, action_id: &'a str, ) -> impl Iterator<Item = &'a ExperienceRecord> + 'a

Returns records for one subject and action in observation order.

Source

pub fn assess( &self, subject: &EntityId, action_id: &str, policy: ExperiencePolicy, ) -> ExperienceAssessment

Assesses the latest completed result for each distinct verification case.

Source

pub fn suppressed_actions( &self, subject: &EntityId, policy: ExperiencePolicy, ) -> BTreeSet<String>

Returns policy-suppressed action IDs for one subject in stable order.

Trait Implementations§

Source§

impl Clone for ExperienceStore

Source§

fn clone(&self) -> ExperienceStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExperienceStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExperienceStore

Source§

fn default() -> ExperienceStore

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ExperienceStore

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ExperienceStore

Source§

impl PartialEq for ExperienceStore

Source§

fn eq(&self, other: &ExperienceStore) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ExperienceStore

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ExperienceStore

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more