Skip to content

Conversation

@coolreader18
Copy link
Collaborator

Description of Changes

The main thing this does is implement WasmInstance for V8Instance, so we can now change all the vm_call*: impl FnOnce() args on InstanceCommon to instead just take &mut impl WasmInstance. (Obviously our javascript instance is not a wasm instance, but wasmtime::module_host_actor is desperately in need of a rebrand in general, so I just left WasmInstance's as is.)

This vastly simplifies the callsites, and also allows @joshua-spacetime to call views from inside of call_reducer_with_tx, which was the main motivating factor behind this.

If the last commit is a bit much, I'm happy to split it off - I just don't get explicitly asked to refactor the rough edges of the codebase very often :3

Expected complexity level and risk

2 - it's a refactor, but overall pretty straightforward, and Rust lets you do fearless refactoring etc etc

Testing

n/a - internal code change

#[async_trait::async_trait]
pub trait WasmInstance: Send + Sync + 'static {
fn extract_descriptions(&mut self) -> Result<Vec<u8>, DescribeError>;
// TODO: rename and move
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO: rename and move
// TODO: Technically this trait is also used for V8.
// We should rename and move to some place more appropriate.

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.

3 participants