Struct SegmentCursor
pub struct SegmentCursor { /* private fields */ }Expand description
Segment-aware pagination cursor.
Two forms exist, with different stability properties:
-
Archive cursor (
archive:<seq>:<off>): identifies a position in a numbered archive. The sequence number is written into the archive name at rotation time, and a best-effort sidecar preserves the high-water mark across normal restarts. If that sidecar cannot be written, retention removes every numbered archive, and the daemon then restarts, a sequence can be reused and an outstanding cursor can bind to newer history. If the segment has been deleted without sequence reuse, the reader returns an empty page withat_end = truerather than silently jumping elsewhere. -
Active cursor (
active:<off>:<anchor_id>): identifies a position in the current active file. Because the active file’s path is stable but its content is replaced on each rotation, an anchor event id is carried alongside the offset. If the active file no longer contains that event, the reader searches all open segments for the anchor; if found it resumes from that position, if not it returnsat_end = true.
A legacy two-field form (<seg_basename>:<off>) from older daemons is also
accepted on input. It is ambiguous by construction, naming either a legacy
archive or the active file, so it is resolved against the archives first
(an archive name is never reassigned) and then the active file.
The token is opaque to clients: round-trip it verbatim as
?until_segment_cursor=. Constructing or modifying it is unsupported.
Implementations§
Source§impl SegmentCursor
impl SegmentCursor
Sourcepub fn from_wire(s: &str) -> Option<Self>
pub fn from_wire(s: &str) -> Option<Self>
Parse from one of four wire forms:
active:<off>:<anchor_id>— active cursor with anchoractive:<off>— active cursor without anchor (legacy active)archive:<seq>:<off>— numbered archive cursor<basename>:<off>— pre-sequence form, ambiguous by construction: an older daemon issued it for the active file, and it is also how a legacy archive is addressed. Parsing cannot tell them apart, so the ambiguity is carried toresolve_cursor, which tries the archives first and falls back to the active file.
Returns None on any parse error.
Trait Implementations§
Source§impl Clone for SegmentCursor
impl Clone for SegmentCursor
Source§fn clone(&self) -> SegmentCursor
fn clone(&self) -> SegmentCursor
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more