Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions src/zalsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub struct Zalsa {
ingredients_vec: Vec<Box<dyn Ingredient>>,

/// Indices of ingredients that require reset when a new revision starts.
ingredients_requiring_reset: boxcar::Vec<IngredientIndex>,
ingredients_requiring_reset: Vec<IngredientIndex>,

/// The runtime for this particular salsa database handle.
/// Each handle gets its own runtime, but the runtimes have shared state between them.
Expand All @@ -185,7 +185,7 @@ impl Zalsa {
jar_map: HashMap::default(),
ingredient_to_id_struct_type_id_map: Default::default(),
ingredients_vec: Vec::new(),
ingredients_requiring_reset: boxcar::Vec::new(),
ingredients_requiring_reset: Vec::new(),
runtime: Runtime::default(),
memo_ingredient_indices: Default::default(),
event_callback,
Expand Down Expand Up @@ -438,14 +438,9 @@ impl Zalsa {
let new_revision = self.runtime.new_revision();
let _span = crate::tracing::debug_span!("new_revision", ?new_revision).entered();

for (_, index) in self.ingredients_requiring_reset.iter() {
let index = index.as_u32() as usize;
let ingredient = self
.ingredients_vec
.get_mut(index)
.unwrap_or_else(|| panic!("index `{index}` is uninitialized"));

ingredient.reset_for_new_revision(self.runtime.table_mut());
for ingredient in &self.ingredients_requiring_reset {
self.ingredients_vec[ingredient.as_u32() as usize]
.reset_for_new_revision(self.runtime.table_mut());
}

new_revision
Expand All @@ -455,11 +450,8 @@ impl Zalsa {
#[doc(hidden)]
pub fn evict_lru(&mut self) {
let _span = crate::tracing::debug_span!("evict_lru").entered();
for (_, index) in self.ingredients_requiring_reset.iter() {
let index = index.as_u32() as usize;
self.ingredients_vec
.get_mut(index)
.unwrap_or_else(|| panic!("index `{index}` is uninitialized"))
for ingredient in &self.ingredients_requiring_reset {
self.ingredients_vec[ingredient.as_u32() as usize]
.reset_for_new_revision(self.runtime.table_mut());
}
}
Expand Down
Loading