mod ledger¶
- module ledger¶
Replay-safe aggregate accounting for charged cooperative search work.
Enums
- enum ChargeKind¶
Boundary at which one replica records work.
- LocalProposal¶
Construction of a local Cartesian proposal; no potential call.
- RemoteProposal¶
Construction of a catalog-derived proposal; no potential call.
- DescriptorEvaluation¶
SOAP or ACE evaluation; no potential call.
- AcceptedQuench¶
Potential calls consumed by a quench that produced a valid candidate.
- RejectedQuench¶
Potential calls consumed by a quench that did not produce a candidate.
- FreshValidation¶
Receiving-side fresh potential evaluation.
- Retry¶
Potential calls consumed by a linked deterministic retry.
- RpcFallback¶
Communication failure followed by independent local fallback.
- AuxiliaryEvaluation¶
Potential or gradient calls used by proposal machinery outside a quench.
- BasinEscape¶
Potential calls consumed by one basin-escape attempt.
- SaddleRide¶
Potential calls consumed by one minimum-mode saddle-ride attempt.
Implementations
- impl ChargeKind¶
Functions
- const fn from_wire_code(code: u16) -> Option<Self>¶
Decode one stable protocol discriminant.
- const fn wire_code(self) -> u16¶
Stable protocol discriminant.
- enum LedgerError¶
Invalid event or ledger configuration.
- EmptyReplicaSet¶
At least one replica is required.
- ZeroBudget¶
Each replica requires a positive charged budget.
- AggregateBudgetOverflow¶
The aggregate budget must fit the ledger counter representation.
- UnknownReplica¶
A request names a replica outside the ensemble.
- replica: u32¶
Foreign replica identity.
- ZeroSequence¶
Sequence zero is reserved.
- ConflictingReplay¶
A replay at one identity differs from the stored event.
- replica: u32¶
Replica identity.
- sequence: u64¶
Conflicting sequence.
- UnchargedKindHasCalls¶
An uncharged boundary cannot carry potential calls.
- kind: ChargeKind¶
Uncharged work boundary.
- charged_calls: u64¶
Invalid positive charge.
- ChargedKindHasNoCalls¶
A charged engine boundary must retain its consumed calls.
- kind: ChargeKind¶
Charged work boundary.
- enum LedgerUpdate¶
Result of recording a valid event.
- Recorded¶
A new event entered the ledger.
- Duplicate¶
An identical replay was already present.
Structs and Unions
- struct ChargeSummary¶
Replay-safe work attributed to one charged mechanism.
- events: u64¶
Number of unique operation-boundary events.
- charged_calls: u64¶
Potential calls retained by those events.
- struct CooperativeLedger¶
Isolated ensemble ledger with idempotent event ingestion.
Implementations
- impl CooperativeLedger¶
Functions
- fn aggregate_budget(&self) -> u64¶
Declared aggregate charged-work budget.
- fn attach(&mut self, replica: u32) -> Result<(), LedgerError>¶
Admit a replica that is not yet in the ledger.
A replica already present is accepted again so a journaled attach replays without becoming a duplicate error.
- fn charge_summary(&self, kind: ChargeKind) -> ChargeSummary¶
Aggregate unique events and calls for one work mechanism.
- fn ensemble_total(&self) -> u64¶
Sum of the latest counter from every replica.
- fn event_count(&self) -> usize¶
Number of unique recorded events across replicas.
- fn new(replicas: impl IntoIterator<Item = u32>, per_replica_budget: u64) -> Result<Self, LedgerError>¶
Construct an empty ledger for one explicit ensemble replica set.
- fn record(&mut self, event: ReplicaLedgerEvent) -> Result<LedgerUpdate, LedgerError>¶
Record a new event or classify an identical replay without double charging.
- fn record_first_encounter(&mut self) -> &FirstEncounter¶
Freeze and return the complete counter vector at first target encounter.
- fn replica_total(&self, replica: u32) -> Option<u64>¶
Latest charged counter for one ensemble replica.
- struct FirstEncounter¶
Counter vector frozen at the first validated target encounter.
Implementations
- impl FirstEncounter¶
Functions
- fn ensemble_total(&self) -> u64¶
Sum of all replica counters at the encounter.
- fn replica_totals(&self) -> &[(u32, u64)]¶
Replica counters in ascending identity order.
- struct ReplicaLedgerEvent¶
One immutable replica event with its monotone charged counter.
- replica: u32¶
Replica identity within one isolated ensemble.
- sequence: u64¶
Monotone event sequence, starting at one.
- kind: ChargeKind¶
Work boundary represented by this event.
- charged_calls: u64¶
Potential calls charged at this boundary.
- cumulative_charged: u64¶
Replica charged counter including this event.