From 08cbf3660d6bc3b32a696209b7cc386b75f0db3a Mon Sep 17 00:00:00 2001 From: Christoph Herzog Date: Tue, 12 Sep 2023 13:28:16 +0200 Subject: [PATCH] feat(wasix): Add BuiltinPackageLoader::insert_cached Can be useful when needing to load custom webcs that bypass the backend. --- lib/wasix/src/runtime/package_loader/builtin_loader.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/wasix/src/runtime/package_loader/builtin_loader.rs b/lib/wasix/src/runtime/package_loader/builtin_loader.rs index 10833fd5b70..ecdc7aae620 100644 --- a/lib/wasix/src/runtime/package_loader/builtin_loader.rs +++ b/lib/wasix/src/runtime/package_loader/builtin_loader.rs @@ -73,6 +73,11 @@ impl BuiltinPackageLoader { )) } + /// Insert a container into the in-memory hash. + pub fn insert_cached(&self, hash: WebcHash, container: &Container) { + self.in_memory.save(container, hash); + } + #[tracing::instrument(level = "debug", skip_all, fields(pkg.hash=%hash))] async fn get_cached(&self, hash: &WebcHash) -> Result, Error> { if let Some(cached) = self.in_memory.lookup(hash) {