From 481fb39a270ba426057a4a5b743ccf2a36089119 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 7 Oct 2025 16:00:53 -0400 Subject: [WARP] Add optional `analysis.warp.fetcher` activity to run fetch networked functions as apart of initial analysis This is off by default for the obvious reasons, we may also in the future want to expand upon this with a "matched view" such that the first step a user can take after loading is to validate what functions were matched and decide if they want to keep any of that data. This fetch happens as apart of the initial analysis, such that a headless script will not return from the load function until it has finished fetching. We may want to add a configurable timeout, and/or run the fetch out of band (let load return before fetching finishes). --- plugins/warp/src/cache/container.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugins/warp/src/cache') diff --git a/plugins/warp/src/cache/container.rs b/plugins/warp/src/cache/container.rs index 59b31bad..0b478ed1 100644 --- a/plugins/warp/src/cache/container.rs +++ b/plugins/warp/src/cache/container.rs @@ -15,6 +15,15 @@ pub fn for_cached_containers(f: impl Fn(&dyn Container)) { } } +pub fn for_cached_containers_mut(f: impl Fn(&mut dyn Container)) { + let containers_cache = CONTAINER_CACHE.get_or_init(Default::default); + for container in containers_cache.iter() { + if let Ok(mut guarded_container) = container.write() { + f(guarded_container.as_mut()); + } + } +} + // TODO: The static lifetime here is a little wierd... (we need it to Box) pub fn add_cached_container(container: impl Container + 'static) { let containers_cache = CONTAINER_CACHE.get_or_init(Default::default); -- cgit v1.3.1