Skip to content

Commit

Permalink
feat: remove in-memory SerializedModuleCache, move logic to perist se…
Browse files Browse the repository at this point in the history
…rialized modules to filesystem into ModuleCache
  • Loading branch information
mattyg committed Dec 24, 2024
1 parent 45cac55 commit 4f22138
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 218 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions crates/common/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ pub enum WasmErrorInner {
ModuleBuild(String),
/// The host failed to call a function in the guest.
CallError(String),
/// Host attempted to interact with the module cache before it was initialized.
UninitializedSerializedModuleCache,
}

impl WasmErrorInner {
Expand All @@ -55,8 +53,6 @@ impl WasmErrorInner {
| Self::ModuleBuild(_)
// This is ambiguous so best to treat as potentially corrupt.
| Self::CallError(_)
// We have no cache so cannot cache.
| Self::UninitializedSerializedModuleCache
=> true,
// (De)serialization simply means some input/output data was
// unrecognisable somehow, it doesn't corrupt the guest memory.
Expand Down
11 changes: 7 additions & 4 deletions crates/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ version = "0.0.97"
authors = ["thedavidmeister", "[email protected]"]
edition = "2021"

[lib]
name = "holochain_wasmer_host"
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"

[dependencies]
wasmer = { version = "5.0.2", default-features = false }
wasmer-middlewares = { version = "5.0.2", optional = true }
Expand All @@ -20,10 +25,8 @@ bytes = "1"
hex = "0.4"
thiserror = "2"

[lib]
name = "holochain_wasmer_host"
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"
[dev-dependencies]
tempfile = "3.14.0"

[features]
default = ["error_as_host", "wasmer_sys_dev"]
Expand Down
Loading

0 comments on commit 4f22138

Please sign in to comment.