@@ -34,16 +34,14 @@ pub enum Step {
3434pub enum SourceReady {
3535 /// The next compute call can produce output or finish without blocking.
3636 Ready ,
37- /// New reads were queued through [`Cx::request_read`]. Run again when bytes are available.
38- Read ,
3937 /// Nothing can happen until the condition clears.
4038 Blocked ( SourceBlocked ) ,
4139}
4240
4341/// Why a source cannot compute yet.
4442#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
4543pub enum SourceBlocked {
46- /// A read was requested and has not been delivered .
44+ /// Wait for bytes from newly queued or outstanding reads .
4745 Io ,
4846 /// The inlet needs more batches or its sink to close it. It must be open and have room
4947 /// for its sink to push; debug builds check that the sink can still wake this source.
@@ -57,9 +55,10 @@ pub trait Source: Operator {
5755 /// Returning [`SourceReady::Ready`] guarantees that call can proceed without blocking.
5856 /// Any input or choice made here can be retained by the source for that call.
5957 ///
60- /// Queue one or more reads with [`Cx::request_read`] and return [`SourceReady::Read`] to
61- /// issue them. Readiness is checked again when bytes are available, including bytes already
62- /// delivered; they are available through [`Cx::take_segment`] in arrival order.
58+ /// Queue reads with [`Cx::request_read`] and return
59+ /// `SourceReady::Blocked(SourceBlocked::Io)`. The driver issues newly queued reads
60+ /// before waiting. Readiness is checked again when bytes are available, including bytes
61+ /// already delivered; they are available through [`Cx::take_segment`] in arrival order.
6362 fn ready ( & mut self , _cx : & mut Cx < ' _ > ) -> VortexResult < SourceReady > {
6463 Ok ( SourceReady :: Ready )
6564 }
@@ -153,7 +152,7 @@ pub struct Cx<'a> {
153152 pub ( super ) arena : & ' a mut Arena ,
154153 pub ( super ) inlets : & ' a [ PortId ] ,
155154 pub ( super ) bytes : & ' a mut VecDeque < ( SegmentId , BufferHandle ) > ,
156- pub ( super ) reads : SmallVec < [ SegmentId ; 1 ] > ,
155+ pub ( super ) reads : & ' a mut SmallVec < [ SegmentId ; 1 ] > ,
157156 pub ( super ) session : & ' a VortexSession ,
158157 pub ( super ) exec : & ' a mut ExecutionCtx ,
159158 pub ( super ) touched : & ' a mut InletSet ,
@@ -169,8 +168,9 @@ impl Cx<'_> {
169168 self . changed . pop ( )
170169 }
171170
172- /// Queues a segment read during [`Source::ready`]. Return [`SourceReady::Read`] after
173- /// queuing all the reads needed for this call.
171+ /// Queues a segment read during [`Source::ready`]. Return
172+ /// `SourceReady::Blocked(SourceBlocked::Io)` after queuing the reads needed for
173+ /// this call.
174174 pub fn request_read ( & mut self , segment : SegmentId ) {
175175 self . reads . push ( segment) ;
176176 }
0 commit comments