seqeron 0.18.0
Loading...
Searching...
No Matches
Org.Limitless.Seqeron.Sequencer.Client.PendingSends Class Referencesealed

A producer's ingress frames that its own queue has not yet shown, which of them a leader change or a closed session lost, and their resend ahead of anything new. More...

Inheritance diagram for Org.Limitless.Seqeron.Sequencer.Client.PendingSends:
Collaboration diagram for Org.Limitless.Seqeron.Sequencer.Client.PendingSends:

Public Member Functions

 PendingSends (int capacity)
 A tracker holding nothing, for one producer's own sends.
 
void Track (IDirectBuffer frame, int length, long clusterSessionId, long leadershipTermId)
 A frame the sender placed, read straight after its Send returned true.
 
void OnLeadershipChanged (long leadershipTermId)
 From the stream client's leadership callback: closes the count on every earlier term.
 
void OnNewLeader (long leadershipTermId)
 From the sender, which calls it on every NewLeader.
 
int ResendMissing (IIngressSender sender)
 Resends the missing frames oldest first, each going back to the end of the ring as pending under the term and session it now carries. Stops at the first send that fails, so a later call picks up where this left off. Call it every duty cycle: it is also where this learns which session the sender holds.
 
void OnSequenced (SequencedEvent sequencedEvent)
 Every frame off the queue, in order. Only this producer's own frames and sessions change anything.
 
int DiscardUnconfirmed ()
 Forgets every pending frame, for a producer that knows none of them will be sequenced. Any that are still arrive and match nothing.
 
int Missing ()
 Pending frames a leader change or a closed session has lost, oldest first at the front.
 
bool IsClosed (long clusterSessionId)
 Whether the queue has shown clusterSessionId , the sender's own, closed.
 

Properties

bool IsFull [get]
 Check before sending: a frame that cannot be tracked must not be sent.
 
bool IsHolding [get]
 Send nothing new while this holds: an older term's or session's frames are still unsettled or unresent.
 
int Count [get]
 Frames tracked and not yet seen on the queue, missing ones included.
 
bool IsFaulted [get]
 Latched: the count can no longer be trusted, so fence the producer.
 
- Properties inherited from Org.Limitless.Seqeron.Sequencer.Client.IIngressTracker

Detailed Description

A producer's ingress frames that its own queue has not yet shown, which of them a leader change or a closed session lost, and their resend ahead of anything new.

Why a count is enough. A leader drops ingress stamped with any term but its own, and every election discards the ingress the old leader had not read. So a frame stamped term T is either on the queue before the first LeadershipChanged with a term above T, or lost, and the lost ones are the newest frames stamped T. Once that boundary has passed, every frame still pending with a term below it is Missing. The same holds when the same member wins the new term.

A closed session is a boundary too. The cluster appends nothing from a session once it begins to close it, and its close is in the log after everything it did append, so a frame not on the queue before that session's SessionClosed never will be: it is missing too. A session whose open never committed has no close, but was lost to an election, which the term bounds. Until one of the two shows, a frame on a session the sender no longer submits on is unsettled, and holds.

Resent in order, never twice. A committed frame is never missing, so nothing is duplicated. From a newer term's first sign — the sender's NewLeader or the queue's LeadershipChanged, whichever comes first — until every older frame is seen or resent, IsHolding: send nothing new, and give this to the sender with SetIngressHold, so a send already spinning through the election is given up rather than landing ahead of the resend. It holds the same way while the oldest frame is lost with its session, or unsettled. ResendMissing does the resend, never onto a session the queue has shown closed. Given to an IngressPublisher, this is tracked and gated on without the producer handling a frame.

Own frames are matched by session, not sourceId: a gateway pair shares its sourceId, and cluster session ids are never reused. Each frame records the session it went out on, so a replacement session still matches its earlier frames. An own frame must equal the oldest pending copy; anything else latches IsFaulted, because the order the count relies on no longer holds — most often the sequencer rejected a frame (S-7), so check §9.2 before sending. Tracking into a full ring latches it too: an untracked send breaks the count.

Limits: it lasts only as long as the process, so a promoted standby starts with nothing pending; it needs the producer to follow its own queue, and to call ResendMissing every duty cycle, which is how it learns the sender's session; loss with neither a leader change nor a session close (an ingress image that drops and rejoins within the session timeout) has no boundary and is not detected. PendingSends.java and sequencer/client/PendingSends.hpp are its twins; keep the three in step.

Constructor & Destructor Documentation

◆ PendingSends()

Org.Limitless.Seqeron.Sequencer.Client.PendingSends.PendingSends ( int  capacity)
inline

A tracker holding nothing, for one producer's own sends.

Parameters
capacityframes that may be pending at once; each holds one FrameLayer.MaxIngressLength copy

Member Function Documentation

◆ DiscardUnconfirmed()

int Org.Limitless.Seqeron.Sequencer.Client.PendingSends.DiscardUnconfirmed ( )
inline

Forgets every pending frame, for a producer that knows none of them will be sequenced. Any that are still arrive and match nothing.

Returns
how many were dropped

◆ IsClosed()

bool Org.Limitless.Seqeron.Sequencer.Client.PendingSends.IsClosed ( long  clusterSessionId)
inline

Whether the queue has shown clusterSessionId , the sender's own, closed.

Parameters
clusterSessionIdthe sender's ClusterSessionId

◆ Missing()

int Org.Limitless.Seqeron.Sequencer.Client.PendingSends.Missing ( )
inline

Pending frames a leader change or a closed session has lost, oldest first at the front.

◆ OnLeadershipChanged()

void Org.Limitless.Seqeron.Sequencer.Client.PendingSends.OnLeadershipChanged ( long  leadershipTermId)
inline

From the stream client's leadership callback: closes the count on every earlier term.

Parameters
leadershipTermIdthe LeadershipChanged's term

◆ OnNewLeader()

void Org.Limitless.Seqeron.Sequencer.Client.PendingSends.OnNewLeader ( long  leadershipTermId)
inline

From the sender, which calls it on every NewLeader.

Parameters
leadershipTermIdthe new leader's term

Implements Org.Limitless.Seqeron.Sequencer.Client.IIngressTracker.

◆ OnSequenced()

void Org.Limitless.Seqeron.Sequencer.Client.PendingSends.OnSequenced ( SequencedEvent  sequencedEvent)
inline

Every frame off the queue, in order. Only this producer's own frames and sessions change anything.

Parameters
sequencedEventthe frame

◆ ResendMissing()

int Org.Limitless.Seqeron.Sequencer.Client.PendingSends.ResendMissing ( IIngressSender  sender)
inline

Resends the missing frames oldest first, each going back to the end of the ring as pending under the term and session it now carries. Stops at the first send that fails, so a later call picks up where this left off. Call it every duty cycle: it is also where this learns which session the sender holds.

Parameters
senderthe session to resend on
Returns
how many were resent

◆ Track()

void Org.Limitless.Seqeron.Sequencer.Client.PendingSends.Track ( IDirectBuffer  frame,
int  length,
long  clusterSessionId,
long  leadershipTermId 
)
inline

A frame the sender placed, read straight after its Send returned true.

Parameters
framethe frame, from offset 0
lengthits length in bytes
clusterSessionIdthe sender's ClusterSessionId
leadershipTermIdthe sender's LeadershipTermId

Implements Org.Limitless.Seqeron.Sequencer.Client.IIngressTracker.

Property Documentation

◆ Count

int Org.Limitless.Seqeron.Sequencer.Client.PendingSends.Count
get

Frames tracked and not yet seen on the queue, missing ones included.

◆ IsFaulted

bool Org.Limitless.Seqeron.Sequencer.Client.PendingSends.IsFaulted
get

Latched: the count can no longer be trusted, so fence the producer.

◆ IsFull

bool Org.Limitless.Seqeron.Sequencer.Client.PendingSends.IsFull
get

Check before sending: a frame that cannot be tracked must not be sent.

Implements Org.Limitless.Seqeron.Sequencer.Client.IIngressTracker.

◆ IsHolding

bool Org.Limitless.Seqeron.Sequencer.Client.PendingSends.IsHolding
get

Send nothing new while this holds: an older term's or session's frames are still unsettled or unresent.

Implements Org.Limitless.Seqeron.Sequencer.Client.IIngressTracker.


The documentation for this class was generated from the following file: