mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-02-02 09:46:06 +00:00
Add comments
This commit is contained in:
parent
2d55e83845
commit
a5396a9142
2 changed files with 12 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
use super::{memo::Memo, Configuration, IngredientImpl};
|
||||
use crate::tracked_struct::KeyStruct;
|
||||
use crate::{
|
||||
hash::FxHashSet, key::DependencyIndex, zalsa_local::QueryRevisions, AsDynDatabase as _,
|
||||
DatabaseKeyIndex, Event, EventKind,
|
||||
|
@ -10,6 +11,9 @@ where
|
|||
{
|
||||
/// Compute the old and new outputs and invoke the `clear_stale_output` callback
|
||||
/// for each output that was generated before but is not generated now.
|
||||
///
|
||||
/// This function takes a `&mut` reference to `revisions` to remove outputs
|
||||
/// that no longer exist in this revision from [`QueryRevisions::tracked_struct_ids`].
|
||||
pub(super) fn diff_outputs(
|
||||
&self,
|
||||
db: &C::DbView,
|
||||
|
@ -27,6 +31,8 @@ where
|
|||
}
|
||||
|
||||
if !old_outputs.is_empty() {
|
||||
// Remove the outputs that are no longer present in the current revision
|
||||
// to prevent that the next revision is seeded with a id mapping that no longer exists.
|
||||
revisions.tracked_struct_ids.retain(|_k, value| {
|
||||
!old_outputs.contains(&DependencyIndex {
|
||||
ingredient_index: value.ingredient_index,
|
||||
|
|
|
@ -353,7 +353,12 @@ pub(crate) struct QueryRevisions {
|
|||
|
||||
/// The ids of tracked structs created by this query.
|
||||
/// This is used to seed the next round if the query is
|
||||
/// re-executed.
|
||||
/// re-executed. This ensures that tracked structs
|
||||
/// have the same id across revisions.
|
||||
///
|
||||
/// [`diff_outputs`] removes tracked structs that were created
|
||||
/// in a previous revision but no longer exist
|
||||
/// in the new revision.
|
||||
pub(super) tracked_struct_ids: FxHashMap<KeyStruct, DatabaseKeyIndex>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue