use crate::{ScoreOp, ScoreSnapshot};
pub trait PeerScoringPlugin {
fn add_member(&mut self, member_id: &[u8]) -> bool;
fn remove_member(&mut self, member_id: &[u8]);
fn apply_op(&mut self, op: &ScoreOp) -> bool;
fn apply_ops(&mut self, ops: &[ScoreOp]) -> bool {
let mut crossed = false;
for op in ops {
crossed |= self.apply_op(op);
}
crossed
}
fn apply_snapshot(&mut self, snapshot: &ScoreSnapshot) -> bool;
fn snapshot(&self) -> ScoreSnapshot;
fn score_for(&self, member_id: &[u8]) -> Option<i64>;
fn members_below_threshold(&self) -> Vec<Vec<u8>>;
fn all_members_with_scores(&self) -> Vec<(Vec<u8>, i64)>;
fn threshold(&self) -> i64;
fn set_threshold(&mut self, threshold: i64);
fn default_score(&self) -> i64;
}