pub struct NonzeroDebtCursorEpisode { /* private fields */ }Expand description
Participant-scoped cursor accounting for one provably nonzero-debt episode.
The wrapper requires ClosureDebt, whose constructor rejects componentwise
zero. Unlike the frozen document’s defective fixed occurrence array, its
progress facts are variable and keyed by (participant_index, boundary) as
mandated by docs/design/LP-EXTRACTION-GOAL.md Fix 2. It also owns the hard
observer position, candidate watermark, retained-suffix range, and the
append-free ack class’s capacity floor. Every committed ack recomputes
F' = max(F, min(m, o) + 1, cap_floor) from those durable values.
Implementations§
Source§impl NonzeroDebtCursorEpisode
impl NonzeroDebtCursorEpisode
Sourcepub fn new(
conversation_id: ConversationId,
debt: ClosureDebt,
observer_progress: DeliverySeq,
candidate_high_watermark: DeliverySeq,
current_floor: u128,
cap_floor: u128,
participants: Vec<BoundParticipantCursor>,
) -> Result<Self, CursorEpisodeBuildError>
pub fn new( conversation_id: ConversationId, debt: ClosureDebt, observer_progress: DeliverySeq, candidate_high_watermark: DeliverySeq, current_floor: u128, cap_floor: u128, participants: Vec<BoundParticipantCursor>, ) -> Result<Self, CursorEpisodeBuildError>
Creates one nonzero-debt episode with retained-suffix and floor state.
candidate_high_watermark is H'; the retained suffix is the inclusive
sequence range from current_floor through H', or empty when the floor
is checked H' + 1. cap_floor is the committing append-free ack
class’s actual capacity floor at this initial state.
§Errors
Returns CursorEpisodeBuildError for a duplicate participant, a
cursor/observer beyond H', an invalid retained range, or a capacity
floor outside the initial base and observer bounds.
Sourcepub const fn debt(&self) -> ClosureDebt
pub const fn debt(&self) -> ClosureDebt
Returns the exact nonzero debt proving this episode is active.
Sourcepub const fn observer_progress(&self) -> DeliverySeq
pub const fn observer_progress(&self) -> DeliverySeq
Returns hard observer progress o used by every ack floor transition.
Sourcepub const fn candidate_high_watermark(&self) -> DeliverySeq
pub const fn candidate_high_watermark(&self) -> DeliverySeq
Returns the candidate high watermark H' and retained-suffix end.
Sourcepub const fn cap_floor(&self) -> u128
pub const fn cap_floor(&self) -> u128
Returns the append-free ack transaction class’s current cap_floor.
Sourcepub const fn floor_computation(&self) -> FloorComputation
pub const fn floor_computation(&self) -> FloorComputation
Returns the latest reproducible document floor computation.
Sourcepub fn retained_suffix_start(&self) -> Option<DeliverySeq>
pub fn retained_suffix_start(&self) -> Option<DeliverySeq>
Returns the first retained sequence, or None for an empty suffix.
Sourcepub fn retains(&self, delivery_seq: DeliverySeq) -> bool
pub fn retains(&self, delivery_seq: DeliverySeq) -> bool
Returns whether one durable sequence remains in the retained suffix.
Sourcepub fn participant(
&self,
participant_index: ParticipantIndex,
) -> Option<BoundParticipantCursor>
pub fn participant( &self, participant_index: ParticipantIndex, ) -> Option<BoundParticipantCursor>
Returns one indexed bound participant cursor.
Sourcepub const fn facts(&self) -> &CursorProgressFacts
pub const fn facts(&self) -> &CursorProgressFacts
Returns the participant-scoped cursor fact map.
Sourcepub fn acknowledge(
&mut self,
participant_index: ParticipantIndex,
receiving_binding_epoch: BindingEpoch,
request: &ParticipantAck,
contiguously_available_through: DeliverySeq,
) -> Result<CumulativeAckOutcome, CumulativeAckAuthorizationError>
pub fn acknowledge( &mut self, participant_index: ParticipantIndex, receiving_binding_epoch: BindingEpoch, request: &ParticipantAck, contiguously_available_through: DeliverySeq, ) -> Result<CumulativeAckOutcome, CumulativeAckAuthorizationError>
Applies one authority-checked cumulative normal acknowledgement.
receiving_binding_epoch identifies the connection epoch on which the
request arrived. This scalar entry point preserves the Unit 1 contiguous
suffix selector; Unit 2 production uses
Self::acknowledge_with_obligations so restart-safe durable recipient
testimony, rather than volatile offered progress, decides endpoint
availability. A successful advance records and consumes the fact keyed by
the selected participant index and requested boundary; any lower pending
facts for that participant are consumed in the same transition.
It then recomputes the physical floor from the post-ack minimum cursor,
hard observer progress, current floor, and append-free ack cap_floor.
Another participant’s equal boundary is never touched.
§Errors
Returns CumulativeAckAuthorizationError before any mutation when the
conversation, participant, generation, or active binding epoch differs.
Sourcepub fn acknowledge_with_obligations(
&mut self,
participant_index: ParticipantIndex,
receiving_binding_epoch: BindingEpoch,
request: &ParticipantAck,
obligations: &RecipientAckObligations,
) -> Result<CumulativeAckOutcome, CumulativeAckAuthorizationError>
pub fn acknowledge_with_obligations( &mut self, participant_index: ParticipantIndex, receiving_binding_epoch: BindingEpoch, request: &ParticipantAck, obligations: &RecipientAckObligations, ) -> Result<CumulativeAckOutcome, CumulativeAckAuthorizationError>
Applies the durable per-recipient obligation endpoint rule.
Conversation-global sequence gaps are skipped as non-obligations. A
forward request commits only when its endpoint exists in obligations;
ending on a sender-excluded or otherwise absent sequence returns
AckGap. The testimony must name the selected participant and current
durable cursor exactly.
§Errors
Returns CumulativeAckAuthorizationError before mutation when request
authority or testimony context differs from this episode.
Sourcepub fn encode(&self) -> Result<Vec<u8>, CursorFactEncodeError>
pub fn encode(&self) -> Result<Vec<u8>, CursorFactEncodeError>
Deterministically serializes the active debt, binding-tagged cursors, and facts.
Format: conversation id, debt entries/bytes as two u128 values, observer
progress and H' as two u64 values, current F' and cap_floor as two
u128 values, participant count as u32, participants in index order, then
fact count as u32 and facts in (participant_index, boundary) order. The
retained suffix is reproduced exactly by [F', H']. A participant is
one binding tag plus five u64 values: its canonical identifier/index,
server incarnation, connection ordinal, generation, and cursor. A fact retains the 17-byte
format documented by CursorProgressFacts::encode. This is lifecycle
storage, not the participant network frame format.
§Errors
Returns CursorFactEncodeError if either count or the exact allocation
length cannot be represented.
Trait Implementations§
Source§impl Clone for NonzeroDebtCursorEpisode
impl Clone for NonzeroDebtCursorEpisode
Source§fn clone(&self) -> NonzeroDebtCursorEpisode
fn clone(&self) -> NonzeroDebtCursorEpisode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more