Skip to main content

advance_absolute_id

Function advance_absolute_id 

Source
fn advance_absolute_id(
    prev_object_id: &mut Option<u64>,
    object: &AnySubgroupObject,
    write: impl FnOnce(&AnySubgroupObject) -> Result<(), CodecError>,
) -> Result<(), CodecError>
Expand description

Enforce the strictly-increasing Object ID rule on the drafts that encode IDs absolutely.

Drafts 14-20 get this for free: their delta is id - prev - 1, so a repeated or decreasing ID underflows and the per-draft writer rejects it. Drafts 07-13 write the ID verbatim and would happily emit a stream no publisher can produce, so the check lives here. As on the delta drafts, the state advances only once the object is actually written, which is what makes elision read it and do not write it.