Skip to content

Commit 7259db0

Browse files
committed
Plugin Wasmtime: Add implementation details to proposal
- Add details for the implementation on chipmunk side in the plugin proposal
1 parent 0f2489e commit 7259db0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

developer/src/plugin/wasmtime/proposal.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,19 @@
44
* Using `wit` files allows for plugins written in any language that can compile to WebAssembly, provided they comply to the contract defined in the WIT file.
55
* For Rust plugin we can provide project templates (can be used with [cargo generate](https://github.com/cargo-generate/cargo-generate)) and code examples. Additionally, we can provide a crate containing macros or functions to help the users in implementing the necessary functionality only.
66

7+
## Chipmunk Implementation:
8+
- The main idea is to provide an alternative message-producer with plugin support to be used alongside the native one.
9+
- We can define the `MessageProducer` to use with generics:
10+
```rust
11+
pub trait MessageProducer<T> {
12+
pub fn as_stream(&mut self) -> impl Stream<Item = (usize, MessageStreamItem<T>)> + ...;
13+
}
14+
```
15+
### WASM-Producer
16+
- We create a producer struct to encapsulate the plugin cases.
17+
- The struct can be set behind a feature flag.
18+
- It can support the following four use-cases:
19+
1. Parser as plugin and byte-source is native.
20+
2. Parser is native and Source is plugin which is given to the native `BinaryByteSource` to do the buffering internally. This can be changed to handle buffering on the plugin side if needed.
21+
3. Parser and source as two different plugins, which requires more data copying since it needs to be sent to the host for buffering and then sent back to the parser plugin.
22+
4. Stand-alone producer as a plugin that can be developed directly for special data types like MDF files. The same architecture can be used with composed plugins from a parser and a source plugin, along with a third plugin for buffering. By composing these plugins, we get one plugin that can be treated as a stand-alone one.

0 commit comments

Comments
 (0)