pub enum JoiningStart {
GroupsBefore(u64),
Group(u64),
}Expand description
Where a Joining FETCH starts, said once for the two forms the drafts give it.
A Joining FETCH names no track and no end. Draft-19 Section 10.12.2: “A Joining Fetch is associated with a Subscribe request by specifying the Request ID of an active subscription. A publisher receiving a Joining Fetch uses properties of the associated Subscribe to determine the Track Namespace, Track Name and End Location such that it is contiguous with the associated Subscribe.” So the only thing a subscriber still has to say is where the range begins — and the field that says it is one varint called Joining Start, which means two different things depending on a Fetch Type written six bytes earlier.
That is why this is an enum and not a u64. Section 10.12.2.1 gives the
publisher two sentences for the same field: for a Relative Joining Fetch it
sets the Start Location to “{Subscribe Largest Location.Group - Joining
Start, 0}”, and for an Absolute Joining Fetch it sets the Start Location “to
Joining Start”. A caller handing 3 to a single-number entry point would be
asking for three groups of history on one call and for the whole track from
Group 3 on the other, with nothing in the argument to say which was meant.
AnyConnection::fetch_joining turns the variant into the Fetch Type as
well as the number, so the two cannot come apart.
Variants§
GroupsBefore(u64)
Start this many Groups before the joined subscription’s Largest
Location — Fetch Type 0x2, Relative Joining.
GroupsBefore(0) is the subscription’s own current Group and nothing
earlier; GroupsBefore(1) adds the Group before it. The publisher
clamps at zero — “{Subscribe Largest Location.Group - Joining Start,
0}” — so an offset larger than the track is long asks for the whole of
it rather than being an error.
This is the form a subscriber that has not been told a Largest Location can still use, which is most of them: it is the publisher that does the subtraction.
Group(u64)
Start at this Group, absolutely — Fetch Type 0x3, Absolute Joining.
The Start Location is {Group, 0}. Drafts 08 through 10 have no such
Fetch Type — their FETCH offers Standalone and one Joining kind, and
draft-11 is where the pair arrives — so this variant is refused there
rather than sent as the relative one, which would ask a completely
different question.