pub enum AnyFetchReader {
Show 15 variants
Draft07(FramedRecvStream),
Draft08(FramedRecvStream),
Draft09(FramedRecvStream),
Draft10(FramedRecvStream),
Draft11(FramedRecvStream),
Draft12(FramedRecvStream),
Draft13(FramedRecvStream),
Draft14(FramedRecvStream),
Draft15(FramedRecvStream),
Draft16(Draft16FetchStream),
Draft17(FramedRecvStream),
Draft18(FramedRecvStream),
Draft19(FramedRecvStream),
Draft20(FramedRecvStream),
Draft21(FramedRecvStream),
}Expand description
A fetch stream the peer opened, that this endpoint is reading.
AnySubgroupReader’s twin, returned by AnyConnection::accept_fetch
beside the FETCH_HEADER the peer framed it with.
The two are separate types for the reason the per-draft connections keep
accept_fetch_stream and accept_subgroup_stream separate: the header
decides how every object after it is framed, so a caller has to know which
kind it is expecting before the first byte is read. Nothing here can be
handed a subgroup stream and cope.
Variants§
Draft07(FramedRecvStream)
Draft-07’s fetch stream.
Draft08(FramedRecvStream)
Draft-08’s fetch stream.
Draft09(FramedRecvStream)
Draft-09’s fetch stream.
Draft10(FramedRecvStream)
Draft-10’s fetch stream.
Draft11(FramedRecvStream)
Draft-11’s fetch stream.
Draft12(FramedRecvStream)
Draft-12’s fetch stream.
Draft13(FramedRecvStream)
Draft-13’s fetch stream.
Draft14(FramedRecvStream)
Draft-14’s fetch stream.
Draft15(FramedRecvStream)
Draft-15’s fetch stream.
Draft16(Draft16FetchStream)
Draft-16’s fetch stream, and the resolver its objects need. See
Draft16FetchStream.
Draft17(FramedRecvStream)
Draft-17’s fetch stream.
Draft18(FramedRecvStream)
Draft-18’s fetch stream.
Draft19(FramedRecvStream)
Draft-19’s fetch stream.
Draft20(FramedRecvStream)
Draft-20’s fetch stream.
Draft21(FramedRecvStream)
Draft-21’s fetch stream.
Implementations§
Source§impl AnyFetchReader
impl AnyFetchReader
Sourcepub fn draft(&self) -> DraftVersion
pub fn draft(&self) -> DraftVersion
The draft framing this stream.
Sourcepub fn stream_id(&self) -> u64
pub fn stream_id(&self) -> u64
Which stream this fetch arrived on, on the terms
AnySubgroupWriter::stream_id describes.
Sourcepub async fn read_object(
&mut self,
) -> Result<AnyFetchObject, AnyConnectionError>
pub async fn read_object( &mut self, ) -> Result<AnyFetchObject, AnyConnectionError>
Read the next object on this fetch stream.
§The stream’s end arrives as an error, not as None
For the reason AnySubgroupReader::read_object gives, and one more of
its own: a fetch stream ends when the range it was serving runs out, and
the only thing that says so is the FIN. Returning Option would have to
tell that FIN from a peer that stopped mid-object, which no per-draft
reader can.
§Errors
Everything AnySubgroupReader::read_object can raise, and on drafts 15
through 20 one more class of its own: an object that inherits from an
object that does not exist. The first object of a stream may not leave
out its Group ID or its Object ID, and a stream whose first object does
is refused here rather than resolved against zero — draft-16 Section
10.4.4.1 makes it a PROTOCOL_VIOLATION, and there is no value to produce
even where it does not.