pub struct LearningRecord {
pub category: String,
pub agent_id: String,
pub branch_id: Option<String>,
pub title: String,
pub body: Value,
pub timestamp: SystemTime,
}Expand description
One structured, emittable learning record — the single in-memory
representation of a learning destined for the agent.learning wire
variant.
The aggregator’s working-state entry types (StuckDurationEntry,
RecoveryCycleEntry, ConflictEvent, and the permission counters)
are projected into LearningRecords at flush time. The broker payload is
then produced solely by From<&LearningRecord> for BrokerMessage — there
is no parallel wire-record data model (the
agent-learning-variant “Internal model serialises directly” requirement).
Fields§
§category: StringOpen category tag (see the CATEGORY_* constants).
agent_id: StringPublishing agent id (typically LEARNINGS_AGENT_ID).
branch_id: Option<String>Branch the record is scoped to; None for cross-cutting records
(permission patterns, conflict pairs).
title: StringShort human-readable summary; mirrors the markdown bullet text.
body: ValueCategory-specific structured body.
timestamp: SystemTimeWhen the record was committed; used for the hour bucket and the emitted ISO-8601 wire timestamp.
Implementations§
Source§impl LearningRecord
impl LearningRecord
Sourcepub fn deterministic_id(&self) -> String
pub fn deterministic_id(&self) -> String
Computes the deterministic dedup id: a stable 16-hex-char (64-bit)
hash of a canonical serialisation of category, branch_id, the
body (object keys sorted), and the UTC hour bucket (YYYY-MM-DDTHH).
Uses the std-library DefaultHasher
— no external crypto dependency. The id is not a security primitive;
it only needs to be deterministic for the same canonical input so
consumers can dedupe. Re-publishing the same logical record within one
UTC hour yields the same id; across an hour boundary the id changes so
a genuine recurrence registers.
Trait Implementations§
Source§impl Clone for LearningRecord
impl Clone for LearningRecord
Source§fn clone(&self) -> LearningRecord
fn clone(&self) -> LearningRecord
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 LearningRecord
impl Debug for LearningRecord
Source§impl From<&LearningRecord> for BrokerMessage
impl From<&LearningRecord> for BrokerMessage
Source§fn from(record: &LearningRecord) -> Self
fn from(record: &LearningRecord) -> Self
Source§impl PartialEq for LearningRecord
impl PartialEq for LearningRecord
Source§fn eq(&self, other: &LearningRecord) -> bool
fn eq(&self, other: &LearningRecord) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LearningRecord
Auto Trait Implementations§
impl Freeze for LearningRecord
impl RefUnwindSafe for LearningRecord
impl Send for LearningRecord
impl Sync for LearningRecord
impl Unpin for LearningRecord
impl UnsafeUnpin for LearningRecord
impl UnwindSafe for LearningRecord
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,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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