pub enum GuardedRememberOutcome {
Stored {
outcome: RememberOutcome,
checked: bool,
},
Blocked {
similar: Vec<Similar>,
},
}Expand description
Result of Memory::remember_guarded.
The two variants are intentionally disjoint: a blocked call has no fact id
because it did not allocate one, mutate an index, or append a journal
record. A caller that decides the candidates are compatible can make that
choice explicit by following with ordinary Memory::remember.
Stored additionally reports whether a check happened at all - see
GuardedRememberOutcome::Stored::checked. Without it the two answers
“nothing similar was found” and “nothing could be compared” are the same
value, and a caller reaching for this verb specifically to avoid duplicates
has no way to learn it did not get one.
Variants§
Stored
No candidate crossed the configured similarity thresholds; the fact was stored normally.
Fields
outcome: RememberOutcomeThe committed fact.
checked: boolWhether the similarity detector actually had candidates to compare against.
false means the write was stored unguarded: the detector is
scoped to the fact’s entity and walks that entity’s most recent
live facts, so an input carrying no entity has no candidate set
and cannot block anything, now or after any number of later
writes. The fact is stored, exactly as an ordinary
Memory::remember would have stored it.
true says a comparison took place, including the case where the
entity is new and its candidate set was empty - that is a real
“nothing similar is stored”, and the same call will be compared
properly from the entity’s second fact onwards.
This is not a failure and not a fallback: comparing against every live fact instead is precisely the unbounded work the per-entity candidate cap exists to avoid. It is reported because the alternative is silence, and silence here reads as “checked, and it was clear”.
Blocked
At least one live same-entity fact crossed a similarity threshold; no mutation was made.
Trait Implementations§
Source§impl Clone for GuardedRememberOutcome
impl Clone for GuardedRememberOutcome
Source§fn clone(&self) -> GuardedRememberOutcome
fn clone(&self) -> GuardedRememberOutcome
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more