diff --git a/src/accumulator.rs b/src/accumulator.rs index e6f7e640d..b5712ca28 100644 --- a/src/accumulator.rs +++ b/src/accumulator.rs @@ -11,12 +11,10 @@ use accumulated::Accumulated; use accumulated::AnyAccumulated; use crate::{ - cycle::CycleRecoveryStrategy, ingredient::{fmt_index, Ingredient, Jar, MaybeChangedAfter}, plumbing::IngredientIndices, zalsa::{IngredientIndex, Zalsa}, - zalsa_local::QueryOrigin, - Database, DatabaseKeyIndex, Id, Revision, + Database, Id, Revision, }; mod accumulated; @@ -109,30 +107,6 @@ impl Ingredient for IngredientImpl { panic!("nothing should ever depend on an accumulator directly") } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - CycleRecoveryStrategy::Panic - } - - fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option { - None - } - - fn mark_validated_output( - &self, - _db: &dyn Database, - _executor: DatabaseKeyIndex, - _output_key: crate::Id, - ) { - } - - fn remove_stale_output( - &self, - _db: &dyn Database, - _executor: DatabaseKeyIndex, - _stale_output_key: crate::Id, - ) { - } - fn fmt_index(&self, index: Option, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt_index(A::DEBUG_NAME, index, fmt) } diff --git a/src/function.rs b/src/function.rs index b08045a8f..6f188d885 100644 --- a/src/function.rs +++ b/src/function.rs @@ -235,32 +235,13 @@ where self.maybe_changed_after(db, input, revision) } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - C::CYCLE_STRATEGY - } - - fn origin(&self, db: &dyn Database, key: Id) -> Option { - self.origin(db.zalsa(), key) - } - fn mark_validated_output( &self, - db: &dyn Database, + zalsa: &Zalsa, executor: DatabaseKeyIndex, output_key: crate::Id, ) { - self.validate_specified_value(db, executor, output_key); - } - - fn remove_stale_output( - &self, - _db: &dyn Database, - _executor: DatabaseKeyIndex, - _stale_output_key: crate::Id, - ) { - // This function is invoked when a query Q specifies the value for `stale_output_key` in rev 1, - // but not in rev 2. We don't do anything in this case, we just leave the (now stale) memo. - // Since its `verified_at` field has not changed, it will be considered dirty if it is invoked. + self.validate_specified_value(zalsa, executor, output_key); } fn requires_reset_for_new_revision(&self) -> bool { @@ -286,6 +267,14 @@ where C::DEBUG_NAME } + fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { + C::CYCLE_STRATEGY + } + + fn origin(&self, db: &dyn Database, key: Id) -> Option { + self.origin(db.zalsa(), key) + } + fn accumulated<'db>( &'db self, db: &'db dyn Database, diff --git a/src/function/diff_outputs.rs b/src/function/diff_outputs.rs index 224b0434e..63df4f110 100644 --- a/src/function/diff_outputs.rs +++ b/src/function/diff_outputs.rs @@ -1,7 +1,7 @@ use super::{memo::Memo, Configuration, IngredientImpl}; use crate::{ hash::FxHashSet, key::OutputDependencyIndex, zalsa::Zalsa, zalsa_local::QueryRevisions, - AsDynDatabase as _, Database, DatabaseKeyIndex, Event, EventKind, + Database, DatabaseKeyIndex, Event, EventKind, }; impl IngredientImpl @@ -56,6 +56,6 @@ where }) }); - output.remove_stale_output(zalsa, db.as_dyn_database(), key); + output.remove_stale_output(zalsa); } } diff --git a/src/function/fetch.rs b/src/function/fetch.rs index 9f687ab17..96bcabe41 100644 --- a/src/function/fetch.rs +++ b/src/function/fetch.rs @@ -50,7 +50,7 @@ where let memo_ingredient_index = self.memo_ingredient_index(zalsa, id); loop { if let Some(memo) = self - .fetch_hot(zalsa, db, id, memo_ingredient_index) + .fetch_hot(zalsa, id, memo_ingredient_index) .or_else(|| self.fetch_cold(zalsa, db, id, memo_ingredient_index)) { return memo; @@ -62,14 +62,13 @@ where fn fetch_hot<'db>( &'db self, zalsa: &'db Zalsa, - db: &'db C::DbView, id: Id, memo_ingredient_index: MemoIngredientIndex, ) -> Option<&'db Memo>> { let memo_guard = self.get_memo_from_table_for(zalsa, id, memo_ingredient_index); if let Some(memo) = memo_guard { if memo.value.is_some() - && self.shallow_verify_memo(db, zalsa, self.database_key_index(id), memo) + && self.shallow_verify_memo(zalsa, self.database_key_index(id), memo) { // Unsafety invariant: memo is present in memo_map and we have verified that it is // still valid for the current revision. diff --git a/src/function/maybe_changed_after.rs b/src/function/maybe_changed_after.rs index 762455ad4..f32dd2914 100644 --- a/src/function/maybe_changed_after.rs +++ b/src/function/maybe_changed_after.rs @@ -31,7 +31,7 @@ where // Check if we have a verified version: this is the hot path. let memo_guard = self.get_memo_from_table_for(zalsa, id, memo_ingredient_index); if let Some(memo) = memo_guard { - if self.shallow_verify_memo(db, zalsa, database_key_index, memo) { + if self.shallow_verify_memo(zalsa, database_key_index, memo) { return if memo.revisions.changed_at > revision { MaybeChangedAfter::Yes } else { @@ -118,7 +118,6 @@ where #[inline] pub(super) fn shallow_verify_memo( &self, - db: &C::DbView, zalsa: &Zalsa, database_key_index: DatabaseKeyIndex, memo: &Memo>, @@ -146,13 +145,8 @@ where ); if last_changed <= verified_at { // No input of the suitable durability has changed since last verified. - memo.mark_as_verified( - db, - revision_now, - database_key_index, - memo.revisions.accumulated_inputs.load(), - ); - memo.mark_outputs_as_verified(zalsa, db.as_dyn_database(), database_key_index); + memo.mark_as_verified(revision_now, memo.revisions.accumulated_inputs.load()); + memo.mark_outputs_as_verified(zalsa, database_key_index); return true; } @@ -181,7 +175,7 @@ where old_memo = old_memo.tracing_debug() ); - if self.shallow_verify_memo(db, zalsa, database_key_index, old_memo) { + if self.shallow_verify_memo(zalsa, database_key_index, old_memo) { return true; } @@ -241,16 +235,12 @@ where // by this function cannot be read until this function is marked green, // so even if we mark them as valid here, the function will re-execute // and overwrite the contents. - dependency_index.mark_validated_output( - zalsa, - dyn_db, - database_key_index, - ); + dependency_index.mark_validated_output(zalsa, database_key_index); } } } - old_memo.mark_as_verified(db, zalsa.current_revision(), database_key_index, inputs); + old_memo.mark_as_verified(zalsa.current_revision(), inputs); true } } diff --git a/src/function/memo.rs b/src/function/memo.rs index 844da0d5f..efaac37e8 100644 --- a/src/function/memo.rs +++ b/src/function/memo.rs @@ -8,10 +8,7 @@ use crate::revision::AtomicRevision; use crate::table::memo::MemoTable; use crate::zalsa::MemoIngredientIndex; use crate::zalsa_local::QueryOrigin; -use crate::{ - key::DatabaseKeyIndex, zalsa::Zalsa, zalsa_local::QueryRevisions, Event, EventKind, Id, - Revision, -}; +use crate::{key::DatabaseKeyIndex, zalsa::Zalsa, zalsa_local::QueryRevisions, Id, Revision}; use super::{Configuration, IngredientImpl}; @@ -136,19 +133,11 @@ impl Memo { /// Mark memo as having been verified in the `revision_now`, which should /// be the current revision. - pub(super) fn mark_as_verified( + pub(super) fn mark_as_verified( &self, - db: &Db, revision_now: Revision, - database_key_index: DatabaseKeyIndex, accumulated: InputAccumulatedValues, ) { - db.salsa_event(&|| { - Event::new(EventKind::DidValidateMemoizedValue { - database_key: database_key_index, - }) - }); - self.verified_at.store(revision_now); self.revisions.accumulated_inputs.store(accumulated); } @@ -156,11 +145,10 @@ impl Memo { pub(super) fn mark_outputs_as_verified( &self, zalsa: &Zalsa, - db: &dyn crate::Database, database_key_index: DatabaseKeyIndex, ) { for output in self.revisions.origin.outputs() { - output.mark_validated_output(zalsa, db, database_key_index); + output.mark_validated_output(zalsa, database_key_index); } } diff --git a/src/function/specify.rs b/src/function/specify.rs index 4338e9157..607110763 100644 --- a/src/function/specify.rs +++ b/src/function/specify.rs @@ -2,9 +2,9 @@ use crate::{ accumulator::accumulated_map::InputAccumulatedValues, revision::AtomicRevision, tracked_struct::TrackedStructInDb, - zalsa::ZalsaDatabase, + zalsa::{Zalsa, ZalsaDatabase}, zalsa_local::{QueryOrigin, QueryRevisions}, - AsDynDatabase as _, Database, DatabaseKeyIndex, Id, + AsDynDatabase as _, DatabaseKeyIndex, Id, }; use super::{memo::Memo, Configuration, IngredientImpl}; @@ -101,13 +101,12 @@ where /// and `key` is a value that was specified by `executor`. /// Marks `key` as valid in the current revision since if `executor` had re-executed, /// it would have specified `key` again. - pub(super) fn validate_specified_value( + pub(super) fn validate_specified_value( &self, - db: &Db, + zalsa: &Zalsa, executor: DatabaseKeyIndex, key: Id, ) { - let zalsa = db.zalsa(); let memo_ingredient_index = self.memo_ingredient_index(zalsa, key); let memo = match self.get_memo_from_table_for(zalsa, key, memo_ingredient_index) { @@ -125,12 +124,6 @@ where ), } - let database_key_index = self.database_key_index(key); - memo.mark_as_verified( - db, - zalsa.current_revision(), - database_key_index, - InputAccumulatedValues::Empty, - ); + memo.mark_as_verified(zalsa.current_revision(), InputAccumulatedValues::Empty); } } diff --git a/src/ingredient.rs b/src/ingredient.rs index dba70f644..2da2faa1b 100644 --- a/src/ingredient.rs +++ b/src/ingredient.rs @@ -62,50 +62,32 @@ pub trait Ingredient: Any + std::fmt::Debug + Send + Sync { revision: Revision, ) -> MaybeChangedAfter; - /// What were the inputs (if any) that were used to create the value at `key_index`. - fn origin(&self, db: &dyn Database, key_index: Id) -> Option; - - /// What values were accumulated during the creation of the value at `key_index` - /// (if any). - /// - /// In practice, returns `Some` only for tracked function ingredients. - fn accumulated<'db>( - &'db self, - db: &'db dyn Database, - key_index: Id, - ) -> (Option<&'db AccumulatedMap>, InputAccumulatedValues) { - _ = (db, key_index); - (None, InputAccumulatedValues::Any) - } - /// Invoked when the value `output_key` should be marked as valid in the current revision. /// This occurs because the value for `executor`, which generated it, was marked as valid /// in the current revision. - fn mark_validated_output<'db>( - &'db self, - db: &'db dyn Database, + fn mark_validated_output( + &self, + zalsa: &Zalsa, executor: DatabaseKeyIndex, output_key: crate::Id, - ); + ) { + let _ = (zalsa, executor, output_key); + unreachable!("only tracked struct and function ingredients can have validatable outputs") + } /// Invoked when the value `stale_output` was output by `executor` in a previous /// revision, but was NOT output in the current revision. /// /// This hook is used to clear out the stale value so others cannot read it. - fn remove_stale_output( - &self, - db: &dyn Database, - executor: DatabaseKeyIndex, - stale_output_key: Id, - ); + fn remove_stale_output(&self, zalsa: &Zalsa, stale_output_key: Id) { + let _ = (zalsa, stale_output_key); + unreachable!("only tracked struct ingredients can have stale outputs") + } /// Returns the [`IngredientIndex`] of this ingredient. fn ingredient_index(&self) -> IngredientIndex; - /// If this ingredient is a participant in a cycle, what is its cycle recovery strategy? - /// (Really only relevant to [`crate::function::FunctionIngredient`], - /// since only function ingredients push themselves onto the active query stack.) - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy; + fn fmt_index(&self, index: Option, fmt: &mut fmt::Formatter<'_>) -> fmt::Result; /// Returns true if `reset_for_new_revision` should be called when new revisions start. /// Invoked once when ingredient is added and not after that. @@ -132,7 +114,31 @@ pub trait Ingredient: Any + std::fmt::Debug + Send + Sync { ); } - fn fmt_index(&self, index: Option, fmt: &mut fmt::Formatter<'_>) -> fmt::Result; + // Function ingredient methods + + /// If this ingredient is a participant in a cycle, what is its cycle recovery strategy? + /// (Really only relevant to [`crate::function::FunctionIngredient`], + /// since only function ingredients push themselves onto the active query stack.) + fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { + unreachable!("only function ingredients can be part of a cycle") + } + + /// What were the inputs (if any) that were used to create the value at `key_index`. + fn origin(&self, db: &dyn Database, key_index: Id) -> Option { + let _ = (db, key_index); + unreachable!("only function ingredients have origins") + } + + /// What values were accumulated during the creation of the value at `key_index` + /// (if any). + fn accumulated<'db>( + &'db self, + db: &'db dyn Database, + key_index: Id, + ) -> (Option<&'db AccumulatedMap>, InputAccumulatedValues) { + let _ = (db, key_index); + (None, InputAccumulatedValues::Empty) + } } impl dyn Ingredient { diff --git a/src/input.rs b/src/input.rs index cf99e9702..d064ea6f6 100644 --- a/src/input.rs +++ b/src/input.rs @@ -12,7 +12,6 @@ use input_field::FieldIngredientImpl; use crate::{ accumulator::accumulated_map::InputAccumulatedValues, - cycle::CycleRecoveryStrategy, id::{AsId, FromIdWithDb}, ingredient::{fmt_index, Ingredient, MaybeChangedAfter}, input::singleton::{Singleton, SingletonChoice}, @@ -20,7 +19,6 @@ use crate::{ plumbing::{Jar, Stamp}, table::{memo::MemoTable, sync::SyncTable, Slot, Table}, zalsa::{IngredientIndex, Zalsa}, - zalsa_local::QueryOrigin, Database, Durability, Id, Revision, Runtime, }; @@ -226,38 +224,6 @@ impl Ingredient for IngredientImpl { MaybeChangedAfter::No(InputAccumulatedValues::Empty) } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - CycleRecoveryStrategy::Panic - } - - fn origin(&self, _db: &dyn Database, _key_index: Id) -> Option { - None - } - - fn mark_validated_output( - &self, - _db: &dyn Database, - executor: DatabaseKeyIndex, - output_key: Id, - ) { - unreachable!( - "mark_validated_output({:?}, {:?}): input cannot be the output of a tracked function", - executor, output_key - ); - } - - fn remove_stale_output( - &self, - _db: &dyn Database, - executor: DatabaseKeyIndex, - stale_output_key: Id, - ) { - unreachable!( - "remove_stale_output({:?}, {:?}): input cannot be the output of a tracked function", - executor, stale_output_key - ); - } - fn fmt_index(&self, index: Option, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt_index(C::DEBUG_NAME, index, fmt) } diff --git a/src/input/input_field.rs b/src/input/input_field.rs index 362d3675c..ffc345bd6 100644 --- a/src/input/input_field.rs +++ b/src/input/input_field.rs @@ -1,9 +1,7 @@ -use crate::cycle::CycleRecoveryStrategy; use crate::ingredient::{fmt_index, Ingredient, MaybeChangedAfter}; use crate::input::Configuration; use crate::zalsa::IngredientIndex; -use crate::zalsa_local::QueryOrigin; -use crate::{Database, DatabaseKeyIndex, Id, Revision}; +use crate::{Database, Id, Revision}; use std::fmt; use std::marker::PhantomData; @@ -45,10 +43,6 @@ where self.index } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - CycleRecoveryStrategy::Panic - } - unsafe fn maybe_changed_after( &self, db: &dyn Database, @@ -61,26 +55,6 @@ where MaybeChangedAfter::from(value.stamps[self.field_index].changed_at > revision) } - fn origin(&self, _db: &dyn Database, _key_index: Id) -> Option { - None - } - - fn mark_validated_output( - &self, - _db: &dyn Database, - _executor: DatabaseKeyIndex, - _output_key: Id, - ) { - } - - fn remove_stale_output( - &self, - _db: &dyn Database, - _executor: DatabaseKeyIndex, - _stale_output_key: Id, - ) { - } - fn fmt_index(&self, index: Option, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt_index(C::FIELD_DEBUG_NAMES[self.field_index], index, fmt) } diff --git a/src/interned.rs b/src/interned.rs index 86df09c5b..14e19741f 100644 --- a/src/interned.rs +++ b/src/interned.rs @@ -9,8 +9,7 @@ use crate::table::memo::MemoTable; use crate::table::sync::SyncTable; use crate::table::Slot; use crate::zalsa::{IngredientIndex, Zalsa}; -use crate::zalsa_local::QueryOrigin; -use crate::{Database, DatabaseKeyIndex, Id}; +use crate::{Database, Id}; use std::any::TypeId; use std::fmt; use std::hash::{BuildHasher, Hash, Hasher}; @@ -291,45 +290,6 @@ where MaybeChangedAfter::from(revision < self.reset_at) } - fn cycle_recovery_strategy(&self) -> crate::cycle::CycleRecoveryStrategy { - crate::cycle::CycleRecoveryStrategy::Panic - } - - fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option { - None - } - - fn mark_validated_output( - &self, - _db: &dyn Database, - executor: DatabaseKeyIndex, - output_key: crate::Id, - ) { - unreachable!( - "mark_validated_output({:?}, {:?}): input cannot be the output of a tracked function", - executor, output_key - ); - } - - fn remove_stale_output( - &self, - _db: &dyn Database, - executor: DatabaseKeyIndex, - stale_output_key: crate::Id, - ) { - unreachable!( - "remove_stale_output({:?}, {:?}): interned ids are not outputs", - executor, stale_output_key - ); - } - - // Interned ingredients do not, normally, get deleted except when they are "reset" en masse. - // There ARE methods (e.g., `clear_deleted_entries` and `remove`) for deleting individual - // items, but those are only used for tracked struct ingredients. - fn requires_reset_for_new_revision(&self) -> bool { - false - } - fn fmt_index(&self, index: Option, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt_index(C::DEBUG_NAME, index, fmt) } diff --git a/src/key.rs b/src/key.rs index f3e90bb10..e985abe8a 100644 --- a/src/key.rs +++ b/src/key.rs @@ -36,26 +36,20 @@ impl OutputDependencyIndex { } } - pub(crate) fn remove_stale_output( - &self, - zalsa: &Zalsa, - db: &dyn Database, - executor: DatabaseKeyIndex, - ) { + pub(crate) fn remove_stale_output(&self, zalsa: &Zalsa) { zalsa .lookup_ingredient(self.ingredient_index) - .remove_stale_output(db, executor, self.key_index) + .remove_stale_output(zalsa, self.key_index) } pub(crate) fn mark_validated_output( &self, zalsa: &Zalsa, - db: &dyn Database, database_key_index: DatabaseKeyIndex, ) { zalsa .lookup_ingredient(self.ingredient_index) - .mark_validated_output(db, database_key_index, self.key_index) + .mark_validated_output(zalsa, database_key_index, self.key_index) } } diff --git a/src/table/memo.rs b/src/table/memo.rs index 1d74f8a98..1d8160585 100644 --- a/src/table/memo.rs +++ b/src/table/memo.rs @@ -218,30 +218,22 @@ impl MemoTable { /// /// The caller needs to make sure to not call this function until no more references into /// the database exist as there may be outstanding borrows into the pointer contents. - pub(crate) unsafe fn into_memos( - self, - ) -> impl Iterator)> { + pub(crate) unsafe fn into_memos(self) -> impl Iterator> { self.memos .into_inner() .into_iter() - .zip(0..) - .filter_map(|(mut memo, index)| memo.data.take().map(|d| (d, index))) + .filter_map(|mut memo| memo.data.take()) .map( - |( - MemoEntryData { - type_id: _, - to_dyn_fn, - atomic_memo, - }, - index, - )| { + |MemoEntryData { + type_id: _, + to_dyn_fn, + atomic_memo, + }| { // SAFETY: The `atomic_memo` field is never null. let memo = unsafe { to_dyn_fn(NonNull::new_unchecked(atomic_memo.into_inner())) }; // SAFETY: The caller guarantees that there are no outstanding borrows into the `Box` contents. - let memo = unsafe { Box::from_raw(memo.as_ptr()) }; - - (MemoIngredientIndex::from_usize(index), memo) + unsafe { Box::from_raw(memo.as_ptr()) } }, ) } diff --git a/src/tracked_struct.rs b/src/tracked_struct.rs index c88a47b04..e9a48dc4b 100644 --- a/src/tracked_struct.rs +++ b/src/tracked_struct.rs @@ -5,7 +5,6 @@ use tracked_field::FieldIngredientImpl; use crate::{ accumulator::accumulated_map::InputAccumulatedValues, - cycle::CycleRecoveryStrategy, ingredient::{fmt_index, Ingredient, Jar, MaybeChangedAfter}, key::{DatabaseKeyIndex, InputDependencyIndex}, plumbing::ZalsaLocal, @@ -14,8 +13,7 @@ use crate::{ salsa_struct::SalsaStructInDb, table::{memo::MemoTable, sync::SyncTable, Slot, Table}, zalsa::{IngredientIndex, Zalsa}, - zalsa_local::QueryOrigin, - Database, Durability, Event, EventKind, Id, Revision, + Database, Durability, Id, Revision, }; pub mod tracked_field; @@ -586,14 +584,7 @@ where /// Using this method on an entity id that MAY be used in the current revision will lead to /// unspecified results (but not UB). See [`InternedIngredient::delete_index`] for more /// discussion and important considerations. - pub(crate) fn delete_entity(&self, db: &dyn crate::Database, id: Id) { - db.salsa_event(&|| { - Event::new(crate::EventKind::DidDiscard { - key: self.database_key_index(id), - }) - }); - - let zalsa = db.zalsa(); + pub(crate) fn delete_entity(&self, zalsa: &Zalsa, id: Id) { let current_revision = zalsa.current_revision(); let data = Self::data_raw(zalsa.table(), id); @@ -620,19 +611,9 @@ where // SAFETY: We have verified that no more references to these memos exist and so we are good // to drop them. - for (memo_ingredient_index, memo) in unsafe { memo_table.into_memos() } { - let ingredient_index = - zalsa.ingredient_index_for_memo(self.ingredient_index, memo_ingredient_index); - - let executor = DatabaseKeyIndex { - ingredient_index, - key_index: id, - }; - - db.salsa_event(&|| Event::new(EventKind::DidDiscard { key: executor })); - + for memo in unsafe { memo_table.into_memos() } { for stale_output in memo.origin().outputs() { - stale_output.remove_stale_output(zalsa, db, executor); + stale_output.remove_stale_output(zalsa); } } @@ -747,17 +728,9 @@ where MaybeChangedAfter::from(data.created_at > revision) } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - crate::cycle::CycleRecoveryStrategy::Panic - } - - fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option { - None - } - - fn mark_validated_output<'db>( - &'db self, - _db: &'db dyn Database, + fn mark_validated_output( + &self, + _zalsa: &Zalsa, _executor: DatabaseKeyIndex, _output_key: crate::Id, ) { @@ -766,17 +739,12 @@ where // FIXME: delete this method } - fn remove_stale_output( - &self, - db: &dyn Database, - _executor: DatabaseKeyIndex, - stale_output_key: crate::Id, - ) { + fn remove_stale_output(&self, zalsa: &Zalsa, stale_output_key: crate::Id) { // This method is called when, in prior revisions, // `executor` creates a tracked struct `salsa_output_key`, // but it did not in the current revision. // In that case, we can delete `stale_output_key` and any data associated with it. - self.delete_entity(db.as_dyn_database(), stale_output_key); + self.delete_entity(zalsa, stale_output_key); } fn fmt_index(&self, index: Option, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/src/tracked_struct/tracked_field.rs b/src/tracked_struct/tracked_field.rs index b69ffebd1..b6af98c82 100644 --- a/src/tracked_struct/tracked_field.rs +++ b/src/tracked_struct/tracked_field.rs @@ -51,10 +51,6 @@ where self.ingredient_index } - fn cycle_recovery_strategy(&self) -> crate::cycle::CycleRecoveryStrategy { - crate::cycle::CycleRecoveryStrategy::Panic - } - unsafe fn maybe_changed_after<'db>( &'db self, db: &'db dyn Database, @@ -67,32 +63,6 @@ where MaybeChangedAfter::from(field_changed_at > revision) } - fn origin( - &self, - _db: &dyn Database, - _key_index: crate::Id, - ) -> Option { - None - } - - fn mark_validated_output( - &self, - _db: &dyn Database, - _executor: crate::DatabaseKeyIndex, - _output_key: crate::Id, - ) { - panic!("tracked field ingredients have no outputs") - } - - fn remove_stale_output( - &self, - _db: &dyn Database, - _executor: crate::DatabaseKeyIndex, - _stale_output_key: crate::Id, - ) { - panic!("tracked field ingredients have no outputs") - } - fn fmt_index( &self, index: Option, diff --git a/src/zalsa.rs b/src/zalsa.rs index a0286b428..9e4c55016 100644 --- a/src/zalsa.rs +++ b/src/zalsa.rs @@ -216,15 +216,6 @@ impl Zalsa { .as_ref() } - pub(crate) fn ingredient_index_for_memo( - &self, - struct_ingredient_index: IngredientIndex, - memo_ingredient_index: MemoIngredientIndex, - ) -> IngredientIndex { - self.memo_ingredient_indices.read()[struct_ingredient_index.as_usize()] - [memo_ingredient_index.as_usize()] - } - /// Starts unwinding the stack if the current revision is cancelled. /// /// This method can be called by query implementations that perform