1
+ use crate :: active_query:: CompletedQuery ;
1
2
use crate :: function:: memo:: Memo ;
2
3
use crate :: function:: { Configuration , IngredientImpl } ;
3
4
use crate :: hash:: FxIndexSet ;
4
5
use crate :: zalsa:: Zalsa ;
5
- use crate :: zalsa_local:: { output_edges, QueryOriginRef , QueryRevisions } ;
6
+ use crate :: zalsa_local:: { output_edges, QueryOriginRef } ;
6
7
use crate :: { DatabaseKeyIndex , Event , EventKind } ;
7
8
8
9
impl < C > IngredientImpl < C >
@@ -16,54 +17,28 @@ where
16
17
zalsa : & Zalsa ,
17
18
key : DatabaseKeyIndex ,
18
19
old_memo : & Memo < ' _ , C > ,
19
- revisions : & QueryRevisions ,
20
- stale_tracked_structs : Vec < DatabaseKeyIndex > ,
20
+ completed_query : & CompletedQuery ,
21
21
) {
22
22
let ( QueryOriginRef :: Derived ( edges) | QueryOriginRef :: DerivedUntracked ( edges) ) =
23
23
old_memo. revisions . origin . as_ref ( )
24
24
else {
25
25
return ;
26
26
} ;
27
27
28
- let stale_outputs = output_edges ( edges ) . collect :: < FxIndexSet < _ > > ( ) ;
29
-
30
- if stale_tracked_structs . is_empty ( ) && stale_outputs . is_empty ( ) {
31
- return ;
28
+ // Note that tracked structs are not stored as direct query outputs, but they are still outputs
29
+ // that need to be reported as stale.
30
+ for output in & completed_query . stale_tracked_structs {
31
+ Self :: report_stale_output ( zalsa , key , * output ) ;
32
32
}
33
33
34
- Self :: diff_outputs_cold ( zalsa, key, revisions, stale_outputs, stale_tracked_structs) ;
35
- }
36
-
37
- #[ cold]
38
- fn diff_outputs_cold (
39
- zalsa : & Zalsa ,
40
- key : DatabaseKeyIndex ,
41
- revisions : & QueryRevisions ,
42
- mut stale_outputs : FxIndexSet < DatabaseKeyIndex > ,
43
- mut stale_tracked_structs : Vec < DatabaseKeyIndex > ,
44
- ) {
45
- if !stale_tracked_structs. is_empty ( ) {
46
- // Removing a stale tracked struct ID shows up in the event logs, so make sure
47
- // the order is stable here.
48
- stale_tracked_structs. sort_unstable_by ( |a, b| {
49
- a. ingredient_index ( )
50
- . cmp ( & b. ingredient_index ( ) )
51
- . then ( a. key_index ( ) . cmp ( & b. key_index ( ) ) )
52
- } ) ;
53
-
54
- // Note that tracked structs are not stored as direct query outputs, but they are still outputs
55
- // that need to be reported as stale.
56
- for output in stale_tracked_structs {
57
- Self :: report_stale_output ( zalsa, key, output) ;
58
- }
59
- }
34
+ let mut stale_outputs = output_edges ( edges) . collect :: < FxIndexSet < _ > > ( ) ;
60
35
61
36
if stale_outputs. is_empty ( ) {
62
37
return ;
63
38
}
64
39
65
40
// Preserve any outputs that were recreated in the current revision.
66
- for new_output in revisions. origin . as_ref ( ) . outputs ( ) {
41
+ for new_output in completed_query . revisions . origin . as_ref ( ) . outputs ( ) {
67
42
stale_outputs. swap_remove ( & new_output) ;
68
43
}
69
44
0 commit comments