@@ -577,7 +577,7 @@ impl<T:Timestamp> Tracker<T> {
577
577
. collect :: < Vec < _ > > ( ) ;
578
578
579
579
if !target_changes. is_empty ( ) {
580
- logger. log_target_updates ( Box :: new ( target_changes) ) ;
580
+ logger. log_target_pointstamp_updates ( Box :: new ( target_changes) ) ;
581
581
}
582
582
583
583
let source_changes =
@@ -587,7 +587,7 @@ impl<T:Timestamp> Tracker<T> {
587
587
. collect :: < Vec < _ > > ( ) ;
588
588
589
589
if !source_changes. is_empty ( ) {
590
- logger. log_source_updates ( Box :: new ( source_changes) ) ;
590
+ logger. log_source_pointstamp_updates ( Box :: new ( source_changes) ) ;
591
591
}
592
592
}
593
593
@@ -641,6 +641,9 @@ impl<T:Timestamp> Tracker<T> {
641
641
// The intent is that that by moving forward in layers through `time`, we
642
642
// will discover zero-change times when we first visit them, as no further
643
643
// 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
+
644
647
while let Some ( Reverse ( ( time, location, mut diff) ) ) = self . worklist . pop ( ) {
645
648
646
649
// Drain and accumulate all updates that have the same time and location.
@@ -672,8 +675,10 @@ impl<T:Timestamp> Tracker<T> {
672
675
}
673
676
}
674
677
}
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) ) ;
676
680
}
681
+
677
682
}
678
683
// Update to an operator output.
679
684
// Propagate any changes forward along outgoing edges.
@@ -693,12 +698,19 @@ impl<T:Timestamp> Tracker<T> {
693
698
diff,
694
699
) ) ) ;
695
700
}
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) ) ;
697
703
}
698
704
} ,
699
705
} ;
700
706
}
701
707
}
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
+ }
702
714
}
703
715
704
716
/// Implications of maintained capabilities projected to each output.
@@ -846,19 +858,39 @@ pub mod logging {
846
858
Self { path, logger }
847
859
}
848
860
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 > ) {
851
882
self . logger . log ( {
852
- SourceUpdate {
883
+ SourceFrontierUpdate {
853
884
tracker_id : self . path . clone ( ) ,
854
885
updates,
855
886
}
856
887
} )
857
888
}
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 > ) {
860
892
self . logger . log ( {
861
- TargetUpdate {
893
+ TargetFrontierUpdate {
862
894
tracker_id : self . path . clone ( ) ,
863
895
updates,
864
896
}
@@ -868,34 +900,70 @@ pub mod logging {
868
900
869
901
/// Events that the tracker may record.
870
902
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 ) ,
875
911
}
876
912
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 {
879
915
/// An identifier for the tracker.
880
916
pub tracker_id : Vec < usize > ,
881
917
/// Updates themselves, as `(node, port, time, diff)`.
882
918
pub updates : Box < dyn ProgressEventTimestampVec > ,
883
919
}
884
920
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 {
887
923
/// An identifier for the tracker.
888
924
pub tracker_id : Vec < usize > ,
889
925
/// Updates themselves, as `(node, port, time, diff)`.
890
926
pub updates : Box < dyn ProgressEventTimestampVec > ,
891
927
}
892
928
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 > ,
895
935
}
896
936
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
+ }
899
967
}
900
968
}
901
969
@@ -914,7 +982,7 @@ impl<T: Timestamp> Drop for Tracker<T> {
914
982
915
983
// Retract pending data that `propagate_all` would normally log.
916
984
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
918
986
. iter_mut ( )
919
987
. enumerate ( )
920
988
. flat_map ( |( port, target) | {
@@ -923,11 +991,11 @@ impl<T: Timestamp> Drop for Tracker<T> {
923
991
. map ( move |( time, diff) | ( index, port, time. clone ( ) , -diff) )
924
992
} )
925
993
. 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 ) ) ;
928
996
}
929
997
930
- let source_changes = per_operator. sources
998
+ let source_pointstamp_changes = per_operator. sources
931
999
. iter_mut ( )
932
1000
. enumerate ( )
933
1001
. flat_map ( |( port, source) | {
@@ -936,8 +1004,36 @@ impl<T: Timestamp> Drop for Tracker<T> {
936
1004
. map ( move |( time, diff) | ( index, port, time. clone ( ) , -diff) )
937
1005
} )
938
1006
. 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) ) ;
941
1037
}
942
1038
}
943
1039
}
0 commit comments