diff --git a/src/accumulator.rs b/src/accumulator.rs index b9355419..1e6d7e6f 100644 --- a/src/accumulator.rs +++ b/src/accumulator.rs @@ -61,7 +61,7 @@ pub struct IngredientImpl { } impl IngredientImpl { - /// Find the accumulator ingrediate for `A` in the database, if any. + /// Find the accumulator ingredient for `A` in the database, if any. pub fn from_db(db: &Db) -> Option<&Self> where Db: ?Sized + Database, diff --git a/src/function/accumulated.rs b/src/function/accumulated.rs index d8b0fcfc..588e42d1 100644 --- a/src/function/accumulated.rs +++ b/src/function/accumulated.rs @@ -53,8 +53,9 @@ where continue; } + let ingredient = zalsa.lookup_ingredient(k.ingredient_index); // Extend `output` with any values accumulated by `k`. - if let Some(accumulated_map) = k.accumulated(db) { + if let Some(accumulated_map) = ingredient.accumulated(db, k.key_index) { accumulated_map.extend_with_accumulated(accumulator.index(), &mut output); // Skip over the inputs because we know that the entire sub-graph has no accumulated values @@ -69,10 +70,7 @@ where // output vector, we want to push in execution order, so reverse order to // ensure the first child that was executed will be the first child popped // from the stack. - let Some(origin) = zalsa - .lookup_ingredient(k.ingredient_index) - .origin(db, k.key_index) - else { + let Some(origin) = ingredient.origin(db, k.key_index) else { continue; }; diff --git a/src/key.rs b/src/key.rs index 92e63541..67ce3e3e 100644 --- a/src/key.rs +++ b/src/key.rs @@ -1,7 +1,4 @@ -use crate::{ - accumulator::accumulated_map::AccumulatedMap, cycle::CycleRecoveryStrategy, - zalsa::IngredientIndex, Database, Id, -}; +use crate::{cycle::CycleRecoveryStrategy, zalsa::IngredientIndex, Database, Id}; /// An integer that uniquely identifies a particular query instance within the /// database. Used to track dependencies between queries. Fully ordered and @@ -99,12 +96,6 @@ impl DatabaseKeyIndex { pub(crate) fn cycle_recovery_strategy(self, db: &dyn Database) -> CycleRecoveryStrategy { self.ingredient_index.cycle_recovery_strategy(db) } - - pub(crate) fn accumulated(self, db: &dyn Database) -> Option<&AccumulatedMap> { - db.zalsa() - .lookup_ingredient(self.ingredient_index) - .accumulated(db, self.key_index) - } } impl std::fmt::Debug for DatabaseKeyIndex {