mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-11-29 02:59:08 +00:00
inline probe_memoized_value
This commit is contained in:
parent
485df37e6f
commit
4cae741768
1 changed files with 18 additions and 27 deletions
|
@ -340,15 +340,26 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryState::Memoized(memo) => {
|
QueryState::Memoized(memo) => {
|
||||||
debug!("{:?}: found memoized value", self);
|
debug!(
|
||||||
|
"{:?}: found memoized value, verified_at={:?}, changed_at={:?}",
|
||||||
|
self, memo.verified_at, memo.changed_at,
|
||||||
|
);
|
||||||
|
|
||||||
if let Some(value) = memo.probe_memoized_value(revision_now) {
|
if let Some(value) = &memo.value {
|
||||||
info!(
|
if memo.verified_at == revision_now {
|
||||||
"{:?}: returning memoized value changed at {:?}",
|
let value = StampedValue {
|
||||||
self, value.changed_at
|
durability: memo.durability,
|
||||||
);
|
changed_at: memo.changed_at,
|
||||||
|
value: value.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
return ProbeState::UpToDate(Ok(value));
|
info!(
|
||||||
|
"{:?}: returning memoized value changed at {:?}",
|
||||||
|
self, value.changed_at
|
||||||
|
);
|
||||||
|
|
||||||
|
return ProbeState::UpToDate(Ok(value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -710,26 +721,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the memoized value *if* it is known to be update in the given revision.
|
|
||||||
fn probe_memoized_value(&self, revision_now: Revision) -> Option<StampedValue<Q::Value>> {
|
|
||||||
let value = self.value.as_ref()?;
|
|
||||||
|
|
||||||
debug!(
|
|
||||||
"probe_memoized_value(verified_at={:?}, changed_at={:?})",
|
|
||||||
self.verified_at, self.changed_at,
|
|
||||||
);
|
|
||||||
|
|
||||||
if self.verified_at == revision_now {
|
|
||||||
return Some(StampedValue {
|
|
||||||
durability: self.durability,
|
|
||||||
changed_at: self.changed_at,
|
|
||||||
value: value.clone(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn has_untracked_input(&self) -> bool {
|
fn has_untracked_input(&self) -> bool {
|
||||||
match self.inputs {
|
match self.inputs {
|
||||||
MemoInputs::Untracked => true,
|
MemoInputs::Untracked => true,
|
||||||
|
|
Loading…
Reference in a new issue