Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ModuleConfig.Validate() to allow pre-flight checks on source #281

Merged
merged 2 commits into from
Feb 23, 2022

Conversation

codefromthecrypt
Copy link
Contributor

This adds ModuleConfig.Validate() as needed by wapc-go to ensure a
module instantiated many times later is checked first. This is a method
of config in case we later add the ability to force a format. For now,
it relies on detection and the call-site only use binary anyway.

This adds `ModuleConfig.Validate()` as needed by wapc-go to ensure a
module instantiated many times later is checked first. This is a method
of config in case we later add the ability to force a format. For now,
it relies on detection and the call-site only use binary anyway.

Signed-off-by: Adrian Cole <[email protected]>
@codefromthecrypt
Copy link
Contributor Author

ohh if we are validating we can cache the decode results and improve perf. I will revise one sec!

Signed-off-by: Adrian Cole <[email protected]>
@codefromthecrypt
Copy link
Contributor Author

PTAL this isn't the first place I've seen the same wasm used many times for different modules. It may be the case later that we actually pre-compile it and solve #179

@codefromthecrypt
Copy link
Contributor Author

Thanks again for coming out of holiday @mathetake!

@codefromthecrypt codefromthecrypt merged commit fc26fdd into main Feb 23, 2022
@codefromthecrypt codefromthecrypt deleted the preflight branch February 23, 2022 09:17
codefromthecrypt pushed a commit that referenced this pull request Feb 23, 2022
PR #281 allowed repetitive use of the same module config to avoid
re-decoding the same wasm. However, it is possible that configuration is
renamed in separate goroutines. This makes caching safer by restoring
the `WithName` function deleted earlier. By using this, a configuration
and its cache state are cloned, and doing that is thread safe.

Signed-off-by: Adrian Cole <[email protected]>
codefromthecrypt added a commit that referenced this pull request Feb 23, 2022
PR #281 allowed repetitive use of the same module config to avoid
re-decoding the same wasm. However, it is possible that configuration is
renamed in separate goroutines. This makes caching safer by restoring
the `WithName` function deleted earlier. By using this, a configuration
and its cache state are cloned, and doing that is thread safe.

Signed-off-by: Adrian Cole <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants