@@ -37,19 +37,19 @@ use crate::dataflow::channels::pullers::counter::ConsumedGuard;
3737pub trait CapabilityTrait < T : Timestamp > {
3838 /// The timestamp associated with the capability.
3939 fn time ( & self ) -> & T ;
40- fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > ) -> bool ;
40+ fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > , port : usize ) -> bool ;
4141}
4242
4343impl < T : Timestamp , C : CapabilityTrait < T > > CapabilityTrait < T > for & C {
4444 fn time ( & self ) -> & T { ( * * self ) . time ( ) }
45- fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > ) -> bool {
46- ( * * self ) . valid_for_output ( query_buffer)
45+ fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > , port : usize ) -> bool {
46+ ( * * self ) . valid_for_output ( query_buffer, port )
4747 }
4848}
4949impl < T : Timestamp , C : CapabilityTrait < T > > CapabilityTrait < T > for & mut C {
5050 fn time ( & self ) -> & T { ( * * self ) . time ( ) }
51- fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > ) -> bool {
52- ( * * self ) . valid_for_output ( query_buffer)
51+ fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > , port : usize ) -> bool {
52+ ( * * self ) . valid_for_output ( query_buffer, port )
5353 }
5454}
5555
@@ -66,7 +66,7 @@ pub struct Capability<T: Timestamp> {
6666
6767impl < T : Timestamp > CapabilityTrait < T > for Capability < T > {
6868 fn time ( & self ) -> & T { & self . time }
69- fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > ) -> bool {
69+ fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > , _port : usize ) -> bool {
7070 Rc :: ptr_eq ( & self . internal , query_buffer)
7171 }
7272}
@@ -227,9 +227,9 @@ impl Error for DowngradeError {}
227227/// A shared list of shared output capability buffers.
228228type CapabilityUpdates < T > = Rc < RefCell < Vec < Rc < RefCell < ChangeBatch < T > > > > > > ;
229229
230- /// An capability of an input port.
230+ /// An capability of an input port.
231231///
232- /// Holding onto this capability will implicitly holds onto a capability for all the outputs
232+ /// Holding onto this capability will implicitly holds onto a capability for all the outputs
233233/// ports this input is connected to, after the connection summaries have been applied.
234234///
235235/// This input capability supplies a `retain_for_output(self)` method which consumes the input
@@ -245,14 +245,12 @@ pub struct InputCapability<T: Timestamp> {
245245
246246impl < T : Timestamp > CapabilityTrait < T > for InputCapability < T > {
247247 fn time ( & self ) -> & T { self . time ( ) }
248- fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > ) -> bool {
248+ fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > , port : usize ) -> bool {
249249 let summaries_borrow = self . summaries . borrow ( ) ;
250250 let internal_borrow = self . internal . borrow ( ) ;
251251 // To be valid, the output buffer must match and the timestamp summary needs to be the default.
252- let result = summaries_borrow. iter_ports ( ) . any ( |( port, path) | {
253- Rc :: ptr_eq ( & internal_borrow[ port] , query_buffer) && path. len ( ) == 1 && path[ 0 ] == Default :: default ( )
254- } ) ;
255- result
252+ Rc :: ptr_eq ( & internal_borrow[ port] , query_buffer) &&
253+ summaries_borrow. get ( port) . map_or ( false , |path| path. elements ( ) == [ Default :: default ( ) ] )
256254 }
257255}
258256
@@ -353,8 +351,8 @@ pub struct ActivateCapability<T: Timestamp> {
353351
354352impl < T : Timestamp > CapabilityTrait < T > for ActivateCapability < T > {
355353 fn time ( & self ) -> & T { self . capability . time ( ) }
356- fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > ) -> bool {
357- self . capability . valid_for_output ( query_buffer)
354+ fn valid_for_output ( & self , query_buffer : & Rc < RefCell < ChangeBatch < T > > > , port : usize ) -> bool {
355+ self . capability . valid_for_output ( query_buffer, port )
358356 }
359357}
360358
0 commit comments