pub struct TrustEngine { /* private fields */ }Expand description
Local trust engine based on direct peer observations.
Scores are an exponential moving average of success/failure observations
that decays toward neutral (0.5) when idle. Bounded by MIN_TRUST_SCORE
and MAX_TRUST_SCORE.
This is the sole authority on peer trust scores in the system.
Implementations§
Source§impl TrustEngine
impl TrustEngine
Sourcepub async fn update_node_stats(
&self,
node_id: &PeerId,
update: NodeStatisticsUpdate,
)
pub async fn update_node_stats( &self, node_id: &PeerId, update: NodeStatisticsUpdate, )
Record a peer interaction outcome
Sourcepub fn score(&self, node_id: &PeerId) -> f64
pub fn score(&self, node_id: &PeerId) -> f64
Get current trust score for a peer (synchronous).
Applies time decay lazily — no background task needed.
Returns DEFAULT_NEUTRAL_TRUST (0.5) for unknown peers.
Sourcepub async fn remove_node(&self, node_id: &PeerId)
pub async fn remove_node(&self, node_id: &PeerId)
Remove a peer from the trust system entirely
Trait Implementations§
Source§impl Debug for TrustEngine
impl Debug for TrustEngine
Auto Trait Implementations§
impl Freeze for TrustEngine
impl !RefUnwindSafe for TrustEngine
impl Send for TrustEngine
impl Sync for TrustEngine
impl Unpin for TrustEngine
impl UnsafeUnpin for TrustEngine
impl !UnwindSafe for TrustEngine
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