@@ -577,7 +577,7 @@ impl<T:Timestamp> Tracker<T> {
577577 . collect :: < Vec < _ > > ( ) ;
578578
579579 if !target_changes. is_empty ( ) {
580- logger. log_target_updates ( Box :: new ( target_changes) ) ;
580+ logger. log_target_pointstamp_updates ( Box :: new ( target_changes) ) ;
581581 }
582582
583583 let source_changes =
@@ -587,7 +587,7 @@ impl<T:Timestamp> Tracker<T> {
587587 . collect :: < Vec < _ > > ( ) ;
588588
589589 if !source_changes. is_empty ( ) {
590- logger. log_source_updates ( Box :: new ( source_changes) ) ;
590+ logger. log_source_pointstamp_updates ( Box :: new ( source_changes) ) ;
591591 }
592592 }
593593
@@ -641,6 +641,9 @@ impl<T:Timestamp> Tracker<T> {
641641 // The intent is that that by moving forward in layers through `time`, we
642642 // will discover zero-change times when we first visit them, as no further
643643 // changes can be made to them once we complete them.
644+ let mut target_frontier_changes = Vec :: new ( ) ;
645+ let mut source_frontier_changes = Vec :: new ( ) ;
646+
644647 while let Some ( Reverse ( ( time, location, mut diff) ) ) = self . worklist . pop ( ) {
645648
646649 // Drain and accumulate all updates that have the same time and location.
@@ -672,8 +675,10 @@ impl<T:Timestamp> Tracker<T> {
672675 }
673676 }
674677 }
675- self . pushed_changes . update ( ( location, time) , diff) ;
678+ self . pushed_changes . update ( ( location, time. clone ( ) ) , diff) ;
679+ target_frontier_changes. push ( ( location. node , port_index, time, diff) ) ;
676680 }
681+
677682 }
678683 // Update to an operator output.
679684 // Propagate any changes forward along outgoing edges.
@@ -693,12 +698,19 @@ impl<T:Timestamp> Tracker<T> {
693698 diff,
694699 ) ) ) ;
695700 }
696- self . pushed_changes . update ( ( location, time) , diff) ;
701+ self . pushed_changes . update ( ( location, time. clone ( ) ) , diff) ;
702+ source_frontier_changes. push ( ( location. node , port_index, time, diff) ) ;
697703 }
698704 } ,
699705 } ;
700706 }
701707 }
708+
709+ // If logging is enabled, log frontier updates.
710+ if let Some ( logger) = & mut self . logger {
711+ logger. log_target_frontier_updates ( Box :: new ( target_frontier_changes) ) ;
712+ logger. log_source_frontier_updates ( Box :: new ( source_frontier_changes) ) ;
713+ }
702714 }
703715
704716 /// Implications of maintained capabilities projected to each output.
@@ -846,19 +858,39 @@ pub mod logging {
846858 Self { path, logger }
847859 }
848860
849- /// Log source update events with additional identifying information.
850- pub fn log_source_updates ( & mut self , updates : Box < dyn ProgressEventTimestampVec > ) {
861+ /// Log source pointstamp update events with additional identifying information.
862+ pub fn log_source_pointstamp_updates ( & mut self , updates : Box < dyn ProgressEventTimestampVec > ) {
863+ self . logger . log ( {
864+ SourcePointstampUpdate {
865+ tracker_id : self . path . clone ( ) ,
866+ updates,
867+ }
868+ } )
869+ }
870+ /// Log target pointstamp update events with additional identifying information.
871+ pub fn log_target_pointstamp_updates ( & mut self , updates : Box < dyn ProgressEventTimestampVec > ) {
872+ self . logger . log ( {
873+ TargetPointstampUpdate {
874+ tracker_id : self . path . clone ( ) ,
875+ updates,
876+ }
877+ } )
878+ }
879+
880+ /// Log source frontier update events with additional identifying information.
881+ pub fn log_source_frontier_updates ( & mut self , updates : Box < dyn ProgressEventTimestampVec > ) {
851882 self . logger . log ( {
852- SourceUpdate {
883+ SourceFrontierUpdate {
853884 tracker_id : self . path . clone ( ) ,
854885 updates,
855886 }
856887 } )
857888 }
858- /// Log target update events with additional identifying information.
859- pub fn log_target_updates ( & mut self , updates : Box < dyn ProgressEventTimestampVec > ) {
889+
890+ /// Log target frontier update events with additional identifying information.
891+ pub fn log_target_frontier_updates ( & mut self , updates : Box < dyn ProgressEventTimestampVec > ) {
860892 self . logger . log ( {
861- TargetUpdate {
893+ TargetFrontierUpdate {
862894 tracker_id : self . path . clone ( ) ,
863895 updates,
864896 }
@@ -868,34 +900,70 @@ pub mod logging {
868900
869901 /// Events that the tracker may record.
870902 pub enum TrackerEvent {
871- /// Updates made at a source of data.
872- SourceUpdate ( SourceUpdate ) ,
873- /// Updates made at a target of data.
874- TargetUpdate ( TargetUpdate ) ,
903+ /// Pointstamp updates made at a source of data.
904+ SourcePointstampUpdate ( SourcePointstampUpdate ) ,
905+ /// Pointstamp updates made at a target of data.
906+ TargetPointstampUpdate ( TargetPointstampUpdate ) ,
907+ /// Frontier updates made at a source of data.
908+ SourceFrontierUpdate ( SourceFrontierUpdate ) ,
909+ /// Frontier updates made at a target of data.
910+ TargetFrontierUpdate ( TargetFrontierUpdate ) ,
875911 }
876912
877- /// An update made at a source of data.
878- pub struct SourceUpdate {
913+ /// A pointstamp update made at a source of data.
914+ pub struct SourcePointstampUpdate {
879915 /// An identifier for the tracker.
880916 pub tracker_id : Vec < usize > ,
881917 /// Updates themselves, as `(node, port, time, diff)`.
882918 pub updates : Box < dyn ProgressEventTimestampVec > ,
883919 }
884920
885- /// An update made at a target of data.
886- pub struct TargetUpdate {
921+ /// A pointstamp update made at a target of data.
922+ pub struct TargetPointstampUpdate {
887923 /// An identifier for the tracker.
888924 pub tracker_id : Vec < usize > ,
889925 /// Updates themselves, as `(node, port, time, diff)`.
890926 pub updates : Box < dyn ProgressEventTimestampVec > ,
891927 }
892928
893- impl From < SourceUpdate > for TrackerEvent {
894- fn from ( v : SourceUpdate ) -> TrackerEvent { TrackerEvent :: SourceUpdate ( v) }
929+ /// A frontier update at a source of data.
930+ pub struct SourceFrontierUpdate {
931+ /// An identifier for the tracker.
932+ pub tracker_id : Vec < usize > ,
933+ /// Updates themselves, as `(node, port, time, diff)`.
934+ pub updates : Box < dyn ProgressEventTimestampVec > ,
895935 }
896936
897- impl From < TargetUpdate > for TrackerEvent {
898- fn from ( v : TargetUpdate ) -> TrackerEvent { TrackerEvent :: TargetUpdate ( v) }
937+ /// A frontier update at a target of data.
938+ pub struct TargetFrontierUpdate {
939+ /// An identifier for the tracker.
940+ pub tracker_id : Vec < usize > ,
941+ /// Updates themselves, as `(node, port, time, diff)`.
942+ pub updates : Box < dyn ProgressEventTimestampVec > ,
943+ }
944+
945+ impl From < SourcePointstampUpdate > for TrackerEvent {
946+ fn from ( v : SourcePointstampUpdate ) -> Self {
947+ Self :: SourcePointstampUpdate ( v)
948+ }
949+ }
950+
951+ impl From < TargetPointstampUpdate > for TrackerEvent {
952+ fn from ( v : TargetPointstampUpdate ) -> Self {
953+ Self :: TargetPointstampUpdate ( v)
954+ }
955+ }
956+
957+ impl From < SourceFrontierUpdate > for TrackerEvent {
958+ fn from ( v : SourceFrontierUpdate ) -> Self {
959+ Self :: SourceFrontierUpdate ( v)
960+ }
961+ }
962+
963+ impl From < TargetFrontierUpdate > for TrackerEvent {
964+ fn from ( v : TargetFrontierUpdate ) -> Self {
965+ Self :: TargetFrontierUpdate ( v)
966+ }
899967 }
900968}
901969
@@ -914,7 +982,7 @@ impl<T: Timestamp> Drop for Tracker<T> {
914982
915983 // Retract pending data that `propagate_all` would normally log.
916984 for ( index, per_operator) in self . per_operator . iter_mut ( ) . enumerate ( ) {
917- let target_changes = per_operator. targets
985+ let target_pointstamp_changes = per_operator. targets
918986 . iter_mut ( )
919987 . enumerate ( )
920988 . flat_map ( |( port, target) | {
@@ -923,11 +991,11 @@ impl<T: Timestamp> Drop for Tracker<T> {
923991 . map ( move |( time, diff) | ( index, port, time. clone ( ) , -diff) )
924992 } )
925993 . collect :: < Vec < _ > > ( ) ;
926- if !target_changes . is_empty ( ) {
927- logger. log_target_updates ( Box :: new ( target_changes ) ) ;
994+ if !target_pointstamp_changes . is_empty ( ) {
995+ logger. log_target_pointstamp_updates ( Box :: new ( target_pointstamp_changes ) ) ;
928996 }
929997
930- let source_changes = per_operator. sources
998+ let source_pointstamp_changes = per_operator. sources
931999 . iter_mut ( )
9321000 . enumerate ( )
9331001 . flat_map ( |( port, source) | {
@@ -936,8 +1004,36 @@ impl<T: Timestamp> Drop for Tracker<T> {
9361004 . map ( move |( time, diff) | ( index, port, time. clone ( ) , -diff) )
9371005 } )
9381006 . collect :: < Vec < _ > > ( ) ;
939- if !source_changes. is_empty ( ) {
940- logger. log_source_updates ( Box :: new ( source_changes) ) ;
1007+ if !source_pointstamp_changes. is_empty ( ) {
1008+ logger. log_source_pointstamp_updates ( Box :: new ( source_pointstamp_changes) ) ;
1009+ }
1010+
1011+ let target_frontier_changes = per_operator. targets
1012+ . iter_mut ( )
1013+ . enumerate ( )
1014+ . flat_map ( |( port, target) | {
1015+ let frontier = target. implications . frontier ( ) . to_owned ( ) ;
1016+ frontier
1017+ . into_iter ( )
1018+ . map ( move |time| ( index, port, time, -1 ) )
1019+ } )
1020+ . collect :: < Vec < _ > > ( ) ;
1021+ if !target_frontier_changes. is_empty ( ) {
1022+ logger. log_target_frontier_updates ( Box :: new ( target_frontier_changes) ) ;
1023+ }
1024+
1025+ let source_frontier_changes = per_operator. sources
1026+ . iter_mut ( )
1027+ . enumerate ( )
1028+ . flat_map ( |( port, source) | {
1029+ let frontier = source. implications . frontier ( ) . to_owned ( ) ;
1030+ frontier
1031+ . into_iter ( )
1032+ . map ( move |time| ( index, port, time, -1 ) )
1033+ } )
1034+ . collect :: < Vec < _ > > ( ) ;
1035+ if !source_frontier_changes. is_empty ( ) {
1036+ logger. log_source_frontier_updates ( Box :: new ( source_frontier_changes) ) ;
9411037 }
9421038 }
9431039 }
0 commit comments