/// True if the value of `input`, which must be from this query, may have /// changed after the given revision ended. /// /// This function should only be invoked with a revision less than the current /// revision. fn maybe_changed_after( &self, db: &<Q as QueryDb<'_>>::DynDb, input: DatabaseKeyIndex, revision: Revision, ) -> bool;
maybe_changed_after operation computes whether a query's value may have changed after the given revision. In other words,
Q.maybe_change_since(R) is true if the value of the query
Q may have changed in the revisions
R_now is the current revision. Note that it doesn't make sense to ask
Input queries are set explicitly by the user.
maybe_changed_after can therefore just check when the value was last set and compare.
The logic for derived queries is more complex. We summarize the high-level ideas here, but you may find the flowchart useful to dig deeper. The terminology section may also be useful; in some cases, we link to that section on the first usage of a word.
- If an existing memo is found, then we check if the memo was verified in the current revision. If so, we can compare its changed at revision and return true or false appropriately.
- Otherwise, we must check whether dependencies have been modified:
- Let R be the revision in which the memo was last verified; we wish to know if any of the dependencies have changed since revision R.
- First, we check the durability. For each memo, we track the minimum durability of the memo's dependencies. If the memo has durability D, and there have been no changes to an input with durability D since the last time the memo was verified, then we can consider the memo verified without any further work.
- If the durability check is not sufficient, then we must check the dependencies individually. For this, we iterate over each dependency D and invoke the maybe changed after operation to check whether D has changed since the revision R.
- If no dependency was modified:
- We can mark the memo as verified and use its changed at revision to return true or false.
- Assuming dependencies have been modified: