Skip to content

Commit

Permalink
feat(data_collection/components): Add ability to cache pre-instantiat…
Browse files Browse the repository at this point in the history
…ed modules
  • Loading branch information
KokaKiwi authored and SachaMorard committed Oct 16, 2024
1 parent b2d9a54 commit 70a0e7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/config/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::collections::{HashMap, HashSet};
use std::path::Path;
use std::path::{Path, PathBuf};
use std::sync::OnceLock;

use serde::Deserialize;
Expand Down Expand Up @@ -163,6 +163,7 @@ pub struct BackendConfiguration {
#[derive(Deserialize, Debug, Default, Clone)]
pub struct ComponentsConfiguration {
pub data_collection: Vec<DataCollectionConfiguration>,
pub cache: Option<PathBuf>,
}

#[derive(Deserialize, Debug, Default, Clone)]
Expand Down
6 changes: 6 additions & 0 deletions src/proxy/compute/data_collection/components/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ pub struct ComponentsContext {

impl ComponentsContext {
fn new() -> anyhow::Result<Self> {
let config = &config::get().components;

let mut engine_config = wasmtime::Config::new();
engine_config
.wasm_backtrace_details(wasmtime::WasmBacktraceDetails::Enable)
.wasm_component_model(true)
.async_support(true);

if let Some(path) = config.cache.as_deref() {
engine_config.cache_config_load(path)?;
};

let engine = Engine::new(&engine_config)?;

let mut linker = Linker::new(&engine);
Expand Down

0 comments on commit 70a0e7c

Please sign in to comment.