Expand description
Deterministic hotspot analysis for karma settlement ledgers.
The Cocoshiga spotting principle is observational: preserve the source ledger, rank unresolved positions by absolute size, and report how much of the total imbalance the selected spots explain.
use karma_cigarette_spotting::{CocoshigaSpot, KarmaLedger, SpotRole};
let mut ledger = KarmaLedger::new();
ledger.record("alice", "bob", 10, "support")?;
ledger.record("carol", "bob", 5, "review")?;
let report = CocoshigaSpot::analyze(&ledger)?;
let hottest = report.hottest().unwrap();
assert_eq!(hottest.party().as_str(), "bob");
assert_eq!(hottest.role(), SpotRole::Payer);
assert_eq!(hottest.units(), 15);Structs§
- Cocoshiga
Spot - Implements the Cocoshiga hotspot analysis.
- Karma
Entry - One contribution recorded in a
KarmaLedger. - Karma
Ledger - An append-only collection of karma entries.
- Karma
Spot - One highlighted unresolved party position.
- PartyId
- A stable, non-empty identifier for a party in a ledger.
- Spot
Policy - Selects which unresolved positions appear in a spot report.
- Spot
Report - Immutable result of spotting a ledger.
Enums§
- Karma
Error - Validation and arithmetic failures returned by the crate.
- Spot
Error - Failure returned while configuring or performing spot analysis.
- Spot
Role - Which side of final settlement a spot occupies.