Skip to content

Commit

Permalink
feat: remove in-memory SerializedModuleCache (#136)
Browse files Browse the repository at this point in the history
* feat: remove in-memory SerializedModuleCache, move logic to perist serialized modules to filesystem into ModuleCache

* chore: cleaner docs

* chore: fmt + clippy

* chore: rename fn for clarity

* chore: clearer code

* chore: comment clarity

Co-authored-by: ThetaSinner <[email protected]>

* chore: wording

Co-authored-by: ThetaSinner <[email protected]>

* chore: link to github discussion

Co-authored-by: Jost <[email protected]>

* chore: clearer simpler naming without redundant 'Serialized' and 'Deserialized'

* refactor: separate concerns ModuleBuilder from ModuleCache

---------

Co-authored-by: ThetaSinner <[email protected]>
Co-authored-by: Jost <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2025
1 parent 45cac55 commit 4961063
Show file tree
Hide file tree
Showing 7 changed files with 314 additions and 237 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 4961063

Please sign in to comment.