pub struct KnowledgeBase {
pub sources: Vec<KnowledgeSource>,
/* private fields */
}Expand description
The factor-knowledge base: entries keyed by their stable key, plus the source registry.
Fields§
§sources: Vec<KnowledgeSource>Implementations§
Source§impl KnowledgeBase
impl KnowledgeBase
Sourcepub fn register_source(&mut self, source: KnowledgeSource)
pub fn register_source(&mut self, source: KnowledgeSource)
Registers a knowledge source.
Sourcepub fn insert(&mut self, entry: FactorKnowledge)
pub fn insert(&mut self, entry: FactorKnowledge)
Insert an entry, capping each target’s evidence tier to the entry’s source ceiling, then (re)sealing the content hash so the stored hash reflects the capped tiers. This is the structural guarantee that a source cannot overclaim.
Sourcepub fn get(&self, key: &str) -> Option<&FactorKnowledge>
pub fn get(&self, key: &str) -> Option<&FactorKnowledge>
Gets.
Sourcepub fn iter(&self) -> impl Iterator<Item = &FactorKnowledge>
pub fn iter(&self) -> impl Iterator<Item = &FactorKnowledge>
Iterator.
Sourcepub fn by_kind<'a>(
&'a self,
kind: &'a FactorKind,
) -> impl Iterator<Item = &'a FactorKnowledge>
pub fn by_kind<'a>( &'a self, kind: &'a FactorKind, ) -> impl Iterator<Item = &'a FactorKnowledge>
Entries by kind.
Sourcepub fn verify_integrity(&self) -> Vec<String>
pub fn verify_integrity(&self) -> Vec<String>
Verify every stored entry’s content hash. Returns the keys of any that fail (empty = all good).
Trait Implementations§
Source§impl Clone for KnowledgeBase
impl Clone for KnowledgeBase
Source§impl Debug for KnowledgeBase
impl Debug for KnowledgeBase
Source§impl Default for KnowledgeBase
impl Default for KnowledgeBase
Source§impl<'de> Deserialize<'de> for KnowledgeBase
impl<'de> Deserialize<'de> for KnowledgeBase
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for KnowledgeBase
impl RefUnwindSafe for KnowledgeBase
impl Send for KnowledgeBase
impl Sync for KnowledgeBase
impl Unpin for KnowledgeBase
impl UnsafeUnpin for KnowledgeBase
impl UnwindSafe for KnowledgeBase
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