Leader-only request/reply work tracked across a failover. Every replica feeds it the same clusterSeqNo-ordered stream, so all replicas hold the same outstanding set.
|
| delegate bool | Dispatcher (TKey key, TWork work) |
| | Takes one request; must not call back into the tracker.
|
| |
| void | OnRequest (TKey key, TWork work) |
| | A request seen on the sequenced stream, on every replica. Idempotent on the key, keeping its position.
|
| |
| void | OnReply (TKey key) |
| | Its sequenced reply, on every replica: the request is answered.
|
| |
| void | OnNotLeader () |
| | The leader gate closed: forget what this node dispatched, so the next opening re-dispatches it.
|
| |
| void | OnReplyNotEmitted (TKey key) |
| | The reply offer failed, so no sequenced reply will come. The request stays outstanding.
|
| |
| int | DispatchUndispatched (Dispatcher dispatcher) |
| | Leader only, while the gate is open. Offers each undispatched outstanding request in request order.
|
| |
| bool | IsDispatched (TKey key) |
| | Whether this request has been dispatched and not yet completed.
|
| |
Leader-only request/reply work tracked across a failover. Every replica feeds it the same clusterSeqNo-ordered stream, so all replicas hold the same outstanding set.
-
Outstanding is replicated: a request is outstanding from its sequenced request (OnRequest) until its sequenced reply (OnReply).
-
Dispatched is local: "this node is handling it", cleared by OnNotLeader and OnReplyNotEmitted. Only the leader dispatches.
Emission is at-least-once: a reply lost in an election is dispatched again by the next leader. Key on the request's clusterSeqNo and make the reply a pure function of the request, so a re-emission is identical to the one it may duplicate and consumers can drop it.
Dispatch runs in request order, which is clusterSeqNo order, so emission order is the same on every replica. OutstandingWork.java and app/OutstandingWork.hpp are its twins; keep the three in step.
- Template Parameters
-
| TKey | the request key |
| TWork | the work a dispatch needs |