pub struct BrainState {
pub profiles: HashMap<String, ProfileRecord>,
pub balanced_recall: BalancedRecallState,
pub profile_states: HashMap<String, BalancedRecallState>,
pub bindings: Vec<ProfileBinding>,
pub section_states: HashMap<String, SectionPosteriorState>,
pub router_state: HashMap<String, RouterStateBlob>,
pub adapter_set: HashMap<String, Vec<AdapterRecord>>,
}Expand description
Runtime brain state — profile registry + active state per profile.
Fields§
§profiles: HashMap<String, ProfileRecord>§balanced_recall: BalancedRecallState§profile_states: HashMap<String, BalancedRecallState>§bindings: Vec<ProfileBinding>§section_states: HashMap<String, SectionPosteriorState>§router_state: HashMap<String, RouterStateBlob>§adapter_set: HashMap<String, Vec<AdapterRecord>>Implementations§
Source§impl BrainState
impl BrainState
Sourcepub fn new(entity_capacity: usize) -> Self
pub fn new(entity_capacity: usize) -> Self
Create a fresh BrainState with a single default balanced-recall-v1 profile.
Sourcepub fn to_snapshot(&self) -> BrainStateSnapshot
pub fn to_snapshot(&self) -> BrainStateSnapshot
Serialize the current state to a BrainStateSnapshot for persistence.
Sourcepub fn from_snapshot(
snapshot: BrainStateSnapshot,
entity_capacity: usize,
) -> Self
pub fn from_snapshot( snapshot: BrainStateSnapshot, entity_capacity: usize, ) -> Self
Rebuild live state from a persisted snapshot.
Sourcepub fn reset_posteriors(&mut self)
pub fn reset_posteriors(&mut self)
Reset all posteriors to their prior values and bump the exploration epoch.
Sourcepub fn reset_profile_posteriors(&mut self, profile_id: &str)
pub fn reset_profile_posteriors(&mut self, profile_id: &str)
Reset posteriors for a single named profile, leaving other profiles unchanged.
Sourcepub fn resolve(
&self,
actor: Option<&str>,
namespace: Option<&str>,
consumer_kind: &str,
) -> Option<&ProfileRecord>
pub fn resolve( &self, actor: Option<&str>, namespace: Option<&str>, consumer_kind: &str, ) -> Option<&ProfileRecord>
Resolve which ProfileRecord serves a given (actor, namespace, consumer_kind) triple.
Sourcepub fn resolve_with_match(
&self,
actor: Option<&str>,
namespace: Option<&str>,
consumer_kind: &str,
) -> Option<(&ProfileRecord, String, bool)>
pub fn resolve_with_match( &self, actor: Option<&str>, namespace: Option<&str>, consumer_kind: &str, ) -> Option<(&ProfileRecord, String, bool)>
Resolve a profile for the given context, returning the matched record,
the matched consumer_kind, and whether the result came from an explicit
binding (matched_binding = true) vs. a system-default fallback
(matched_binding = false).
Callers that implement the ADR-035 tier-2 / tier-3 split MUST check
matched_binding: only a true result constitutes a real tier-2 hit.
When false, the caller should fall through to tier-3 (pack-local prior).
Auto Trait Implementations§
impl Freeze for BrainState
impl RefUnwindSafe for BrainState
impl Send for BrainState
impl Sync for BrainState
impl Unpin for BrainState
impl UnsafeUnpin for BrainState
impl UnwindSafe for BrainState
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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