Expand description
Shared Watermark construction for the v2 list APIs.
Both ledger-history backends — the fullnode (sui-rpc-api) and bigtable
(sui-kv-rpc) — and all three list handlers (list_transactions,
list_events, list_checkpoints) emit the same wire Watermark: a resume
cursor plus a completion boundary (checkpoint, the inclusive boundary
checkpoint the scan has fully covered in the request’s ordering direction).
The cursor encoding and the boundary bookkeeping are identical; what differs
per API is how a scan position resolves into a completion-boundary candidate:
list_transactions/list_eventsscan within a checkpoint, so an item at checkpointCdoes NOT proveCcomplete (more matches may sit at higher/lower transaction or event positions). Their covered bound is advanced beforeC— seeadvance_covered_bound_before_checkpoint.list_checkpointsdedupes checkpoint numbers, so “checkpointCemitted” means “checkpointCcomplete.” Its item path directly recordsC; independently resolved frontier candidates are folded withmerge_covered_checkpoint_bound.
This module owns the shared pieces; each handler keeps only its API-specific frontier-to-candidate adapter.
Enums§
- Natural
Range End - Terminal of a successful list scan that renders as the trailing
payload-free
QueryEndframe.ItemLimitnever reaches this type: the drive loops fuse it onto the final item frame and suppress the trailing frame. The wire reason and the watermark policy are projections of the same value, so they cannot disagree. - Scan
Terminal
Functions§
- advance_
covered_ bound_ before_ checkpoint - Advance the inclusive covered bound using a checkpoint that is not itself
proven complete. Transactions, events, and scan frontiers can leave more
matches within checkpoint
C, so the candidate excludesC:C - 1ascending andC + 1descending. The adjusted candidate is then merged by max ascending or min descending. - boundary_
cursor_ cp - Resolve the boundary-cursor checkpoint coordinate for a
list_transactions/list_eventsscan frontier. The cursor encoding is asymmetric: ascendingBoundarycursors advance the cp-range start, so the frontier cp is used directly; descendingBoundarycursors treat the cp coordinate as an EXCLUSIVE upper bound, socp + 1is needed to keepcpitself included on resume. - boundary_
watermark - Build a standalone scan-frontier
Watermark.cursor_cp/positionare the boundary cursor coordinates the caller has already resolved for its scan domain (seeboundary_cursor_cpfor the per-checkpoint scanners’ direction adjustment);boundaryis the accumulated completion boundary. - item_
watermark - Build the embedded
Watermarkfor an item: the cursor encodes this item’s position (so the next request’safter/beforeresumes past it) plus the current direction-matching checkpoint boundary.cp/positionare the item’s cursor coordinates (list_checkpointspasses its cp_seq for both). - merge_
covered_ checkpoint_ bound - Merge a fully covered checkpoint candidate into the accumulated inclusive bound. The bound advances by max in ascending scans and min in descending scans.
- scan_
frontier_ cursor_ cp - Resolve the checkpoint coordinate embedded in a transaction/event/checkpoint scan-frontier cursor independently from the optional completed-checkpoint claim. A missing mapping is representable only at the numeric edge where the frontier itself supplies the sole safe checkpoint coordinate.