pub enum RapReturn {
Fatal,
Severe {
returned_events: u64,
},
}Expand description
How much of a batch a partner returned (GSMA TD.32).
Variants§
Fatal
The whole file was rejected.
None of its events ever entered the recipient’s counts, so the sequence number stays open and a resubmission fills it.
Severe
Individual events were rejected; the file itself was accepted.
Implementations§
Source§impl RapReturn
impl RapReturn
Sourcepub const fn rejects_the_file(self) -> bool
pub const fn rejects_the_file(self) -> bool
true when the whole file must be resent.
Sourcepub const fn accepted_events(self, batch_events: u64) -> Option<u64>
pub const fn accepted_events(self, batch_events: u64) -> Option<u64>
How many events the recipient kept, given what the batch held.
None when a severe return claims more events than the batch contained,
which means the two sides disagree about the file itself.
Sourcepub const fn effect_on(
self,
batch: BatchReconciliation,
) -> Option<BatchReconciliation>
pub const fn effect_on( self, batch: BatchReconciliation, ) -> Option<BatchReconciliation>
Apply the return to a reconciliation the batch had produced.
A fatal return means the batch never counted: everything it ingested
is undone. Records it carried in from an earlier batch are not — they
were held by a predecessor and are still outstanding — so they come back
as held, which is what keeps
PeriodLedger chaining.
A severe return leaves the batch counted and moves the returned
events from billable to rejected. Every other counter is untouched:
a duplicate stays a duplicate and a hold stays a hold, because the
partner returned events, not opinions about the rest of the file.
None when more events came back than the batch released, or when the
batch’s own carry cannot be reconstructed — either is a disagreement
with the partner rather than arithmetic to absorb.
use mediation::{BatchReconciliation, Disposition, RapReturn, SuppressReason};
let mut batch = BatchReconciliation::EMPTY;
batch.observe(&Disposition::Billable);
batch.observe(&Disposition::Billable);
batch.observe(&Disposition::Suppressed(SuppressReason::ZeroRated));
let after = RapReturn::Severe { returned_events: 1 }.effect_on(batch).unwrap();
assert_eq!(after.released(), 1);
assert_eq!(after.rejected(), 1);
assert_eq!(after.suppressed(), 1, "the rest of the file is untouched");
assert!(after.balances());