decdn_reputation/lib.rs
1//! Local reputation scoring for deCDN nodes: each node scores the peers it
2//! deals with from its own delivery outcomes ([ADR 008]).
3//!
4//! [`LocalReputation`] keeps one EWMA score in `[0, 1]` per peer. Feed it each
5//! observed delivery with [`LocalReputation::record`], and read a peer's score
6//! with [`LocalReputation::score`]. An idle score decays back toward neutral
7//! ([ADR 008 § Score Decay]). [`LocalReputationConfig`] sets the smoothing
8//! factor, the neutral score, the decay half-life, and the outcome weights
9//! ([ADR 008 § Local Score Calculation]).
10//!
11//! Every score comes from direct, first-party outcomes. Nodes do not share or
12//! aggregate scores. Scores live in memory only, so a restart starts every peer
13//! at neutral.
14//!
15//! [ADR 008]: https://github.com/decdn/decdn/blob/main/adr/008-reputation.md
16//! [ADR 008 § Score Decay]: https://github.com/decdn/decdn/blob/main/adr/008-reputation.md#score-decay
17//! [ADR 008 § Local Score Calculation]: https://github.com/decdn/decdn/blob/main/adr/008-reputation.md#local-score-calculation
18
19mod interaction;
20pub mod local;
21
22pub use local::{
23 ConfigError, LOCAL_SCORE_MAX_DELTA_PER_REPORT, LocalReputation, LocalReputationConfig, Outcome,
24};