Skip to main content

NonzeroDebtCursorEpisode

Struct NonzeroDebtCursorEpisode 

Source
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

Source

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.

Source

pub const fn debt(&self) -> ClosureDebt

Returns the exact nonzero debt proving this episode is active.

Source

pub const fn observer_progress(&self) -> DeliverySeq

Returns hard observer progress o used by every ack floor transition.

Source

pub const fn candidate_high_watermark(&self) -> DeliverySeq

Returns the candidate high watermark H' and retained-suffix end.

Source

pub const fn cap_floor(&self) -> u128

Returns the append-free ack transaction class’s current cap_floor.

Source

pub const fn floor_computation(&self) -> FloorComputation

Returns the latest reproducible document floor computation.

Source

pub fn retained_suffix_start(&self) -> Option<DeliverySeq>

Returns the first retained sequence, or None for an empty suffix.

Source

pub fn retains(&self, delivery_seq: DeliverySeq) -> bool

Returns whether one durable sequence remains in the retained suffix.

Source

pub fn participant( &self, participant_index: ParticipantIndex, ) -> Option<BoundParticipantCursor>

Returns one indexed bound participant cursor.

Source

pub const fn facts(&self) -> &CursorProgressFacts

Returns the participant-scoped cursor fact map.

Source

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.

Source

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.

Source

pub fn encode(&self) -> Result<Vec<u8>, CursorFactEncodeError>

Deterministically serializes the active debt, bound 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 five u64 values: its one 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

Source§

fn clone(&self) -> NonzeroDebtCursorEpisode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NonzeroDebtCursorEpisode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for NonzeroDebtCursorEpisode

Source§

impl PartialEq for NonzeroDebtCursorEpisode

Source§

fn eq(&self, other: &NonzeroDebtCursorEpisode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NonzeroDebtCursorEpisode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.