Skip to main content

Crate karma_cigarette_spotting

Crate karma_cigarette_spotting 

Source
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§

CocoshigaSpot
Implements the Cocoshiga hotspot analysis.
KarmaEntry
One contribution recorded in a KarmaLedger.
KarmaLedger
An append-only collection of karma entries.
KarmaSpot
One highlighted unresolved party position.
PartyId
A stable, non-empty identifier for a party in a ledger.
SpotPolicy
Selects which unresolved positions appear in a spot report.
SpotReport
Immutable result of spotting a ledger.

Enums§

KarmaError
Validation and arithmetic failures returned by the crate.
SpotError
Failure returned while configuring or performing spot analysis.
SpotRole
Which side of final settlement a spot occupies.