pub struct BrainState {
pub profiles: HashMap<String, ProfileRecord>,
pub balanced_recall: BalancedRecallState,
pub bindings: Vec<ProfileBinding>,
}Expand description
Runtime brain state — profile registry + active state per profile.
ADR-032 §1: BrainState holds profile registry and lifecycle metadata. Posteriors live inside each profile’s own state, opaque to brain.
Fields§
§profiles: HashMap<String, ProfileRecord>Registered profiles indexed by profile_id.
balanced_recall: BalancedRecallStateIn-memory BalancedRecallState for the active default profile.
bindings: Vec<ProfileBinding>Profile binding table — maps (actor, namespace, consumer_kind) → profile_id.
Implementations§
Source§impl BrainState
impl BrainState
pub fn new(entity_capacity: usize) -> Self
pub fn to_snapshot(&self) -> BrainStateSnapshot
pub fn from_snapshot( snapshot: BrainStateSnapshot, entity_capacity: usize, ) -> Self
Sourcepub fn reset_posteriors(&mut self)
pub fn reset_posteriors(&mut self)
Reset the balanced-recall profile posteriors to priors.
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 a profile_id for the given caller context (ADR-032 §10).
Longest-match wins: actor + namespace + consumer_kind beats actor + consumer_kind
beats namespace + consumer_kind beats consumer_kind alone. Returns the
balanced-recall-v1 default when no explicit binding matches.
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
Mutably borrows from an owned value. Read more