MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / load_artifact_module

Function load_artifact_module

src/pglite/aot.rs:98–127  ·  view source on GitHub ↗
(engine: &Engine, artifact_name: &str)

Source from the content-addressed store, hash-verified

96}
97
98pub(crate) fn load_artifact_module(engine: &Engine, artifact_name: &str) -> Result<Module> {
99 let artifact = install_artifact(artifact_name)?;
100 let cache_key = format!("{artifact_name}:{}", artifact.sha256);
101 let module_cache = MODULE_CACHE.get_or_init(|| Mutex::new(HashMap::new()));
102 let mut modules = module_cache.lock().expect("AOT module cache poisoned");
103 if let Some(module) = modules.get(&cache_key) {
104 return Ok(module.clone());
105 }
106
107 let module = match deserialize_headless(engine, &artifact.path) {
108 Ok(module) => module,
109 Err(err) if aot_verify_mode()? == AotVerifyMode::Fast => {
110 let _phase = timing::phase("aot.rebuild_after_deserialize_failure");
111 forget_installed_artifact(artifact_name);
112 remove_cached_artifact(&artifact.path)?;
113 let artifact = rebuild_artifact(artifact_name).with_context(|| {
114 format!("rebuild AOT artifact '{artifact_name}' after deserialize failure")
115 })?;
116 deserialize_headless(engine, &artifact.path).with_context(|| {
117 format!(
118 "deserialize rebuilt Wasmer AOT artifact '{}' after initial failure: {err:#}",
119 artifact.path.display()
120 )
121 })?
122 }
123 Err(err) => return Err(err),
124 };
125 modules.insert(cache_key, module.clone());
126 Ok(module)
127}
128
129#[cfg(feature = "extensions")]
130pub(crate) fn load_pg_dump_module(engine: &Engine) -> Result<Module> {

Callers 5

load_runtime_moduleFunction · 0.85
load_extension_moduleFunction · 0.85
load_pg_dump_moduleFunction · 0.85
load_initdb_moduleFunction · 0.85
seed_wasix_module_cacheFunction · 0.85

Calls 8

install_artifactFunction · 0.85
deserialize_headlessFunction · 0.85
aot_verify_modeFunction · 0.85
phaseFunction · 0.85
remove_cached_artifactFunction · 0.85
rebuild_artifactFunction · 0.85
insertMethod · 0.80

Tested by

no test coverage detected