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
[Merged by Bors] - feat: introduce ByteBuf
for SmartModuleSpec
#2738
[Merged by Bors] - feat: introduce ByteBuf
for SmartModuleSpec
#2738
Conversation
7d72265
to
31b3a93
Compare
e405058
to
c92bb75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better. Couple of issues remain
WasmBytes
for SmartModuleSpec
ByteBuf
for SmartModuleSpec
2e6cbb4
to
7594c1d
Compare
72c11e3
to
2199aec
Compare
2199aec
to
42ccaeb
Compare
44ab15b
to
0e067f4
Compare
Implemented tests to make sure the output is the same as for encoding/decoding from |
Very promising, I think that we should use |
Totally agree! |
I think that we could also grab
|
Im using a SmartModule WASM file for testing. Here is the file in question: https://github.com/EstebanBorai/fluvio/blob/feat/wasmbytes-for-smartmodulespec/crates/fluvio-protocol/fixtures/smartmodule.wasm. The source for this file is actually a filter SmartModule example. Perhaps we could try with the RegExp example for a more "real-life" example? |
That's good enough! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress and very nice work. Just need couple of refinements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement, it looks good to me just a couple of nits.
I see that CI test that checks crate version reports crates that need to be updated but it is not failing, maybe is it an issue with the exit code? CC @tjtelan
https://github.com/infinyon/fluvio/actions/runs/3395995671/jobs/5646561976
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few remaining nits
@@ -109,7 +110,7 @@ pub struct SmartModuleWasmSummary { | |||
pub struct SmartModuleWasm { | |||
pub format: SmartModuleWasmFormat, | |||
#[cfg_attr(feature = "use_serde", serde(with = "base64"))] | |||
pub payload: Vec<u8>, | |||
pub payload: ByteBuf, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove pub
signature, we don't need to expose it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fluvio-sc-schema uses the field:
wasm_length: self.wasm.payload.len() as u32, |
I think we could expose it via method call (similar to the getter pattern)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could create a fn payload_len
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its good for this use case, but we also consume the payload
directly for the SmartModuleInvocationWasm
enum here:
error[E0616]: field `payload` of struct `SmartModuleWasm` is private
--> crates/fluvio-spu/src/smartengine/context.rs:253:78
|
253 | wasm: SmartModuleInvocationWasm::AdHoc(smartmodule.spec.wasm.payload.into()),
I think we could think of an API for these use case on a next PR? In order to encapsulate these fields, and
also provide some unit tests to these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very close. Last nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Tremendous improvement. Ship it!
bors r+ |
In order to have a more performant implementation on WASM bytes, a dedicated type is introduced which provides an specific implementation for bytes representing a WASM file owned by a `SmartModule` instance. Resolves: #2700
Thanks! And to everyone involved! |
Pull request successfully merged into master. Build succeeded:
|
ByteBuf
for SmartModuleSpec
ByteBuf
for SmartModuleSpec
In order to have a more performant implementation on WASM bytes, a
dedicated type is introduced which provides an specific implementation
for bytes representing a WASM file owned by a
SmartModule
instance.Resolves: #2700