(&self, initial_entries: &HashSet<String>)
| 340 | } |
| 341 | |
| 342 | fn cascade_invalidation(&self, initial_entries: &HashSet<String>) -> HashSet<String> { |
| 343 | let mut cascaded = HashSet::new(); |
| 344 | let mut to_process: Vec<String> = initial_entries.iter().cloned().collect(); |
| 345 | let mut processed = HashSet::new(); |
| 346 | |
| 347 | let max_depth = match &self.strategy { |
| 348 | InvalidationStrategy::DependencyBased { max_depth, .. } => *max_depth, |
| 349 | _ => 3, // Default cascade depth |
| 350 | }; |
| 351 | |
| 352 | let mut current_depth = 0; |
| 353 | |
| 354 | while !to_process.is_empty() && current_depth < max_depth { |
| 355 | let current_batch = to_process; |
| 356 | to_process = Vec::new(); |
| 357 | current_depth += 1; |
| 358 | |
| 359 | for entry in current_batch { |
| 360 | if processed.contains(&entry) { |
| 361 | continue; |
| 362 | } |
| 363 | processed.insert(entry.clone()); |
| 364 | |
| 365 | // Find entries that depend on this entry |
| 366 | let dependent_entries = self.find_entries_dependent_on(&entry); |
| 367 | for dep in dependent_entries { |
| 368 | if !cascaded.contains(&dep) && !initial_entries.contains(&dep) { |
| 369 | cascaded.insert(dep.clone()); |
| 370 | to_process.push(dep); |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | cascaded |
| 377 | } |
| 378 | |
| 379 | fn find_entries_dependent_on(&self, _entry_key: &str) -> HashSet<String> { |
| 380 | // This would require reverse dependency tracking |
no test coverage detected