-
Notifications
You must be signed in to change notification settings - Fork 552
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
transform-sdk: experimental C++ support #16229
Conversation
ad8aa26
to
ad44850
Compare
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/44114#018d3347-1914-4f27-9b23-ed60b7a7f080 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/44410#018d4fa3-2a33-4e0c-aaad-bec02b6ed202 |
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.
LGTM w.r.t. github workflow
/ci-repeat |
ce4c935
to
93279f5
Compare
93279f5
to
cb932f3
Compare
f3d9517
to
e388282
Compare
8ea48cb
to
8e12c31
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.
Looks good. As requested focused mostly on the headers and docs. If you're not opposed to squashing up some of the implementation, happy to go through the .cc
in more detail as well.
# Experimental Redpanda Data Transforms C++ SDK | ||
|
||
This directory contains an experimental C++ SDK for Redpanda Data Transforms. | ||
C++23 is required for both language features and standard library support. |
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.
😈
src/transform-sdk/cpp/README.md
Outdated
When writing C++ in WebAssembly, note that certainly language features are not supported. | ||
Noteably C++ exceptions, `setjmp`/`longjmp`, threads and networking is not supported. |
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.
q: are some of these fundamental limitations of wasm as a c++ target, or just more things we don't currently support in our wasi implementation?
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.
This is more of a wasm32 VM feature we're missing. There is no VM support for non local control flow. It's likely going to happen this year, until then we're stuck with -fno-exceptions
(honestly I kind of like it tho).
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.
Cool. I was wondering whether it's worth segmenting into like
- things we don't support
- things the VM doesn't support
- things that can't or will never exist
But given that we're not offering an exhaustive list, maybe not worth 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.
Basically all of these are things are not supported by the VM at the moment (except networking is a wasi limitation). We hope to lift them all in the future (except probably threads). I will add some color here.
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.
std::string generally signifies the data is a valid UTF-8 data,
not sure i understand this part. afaict the standard says std::string stores 1-byte char
s it seems like a fine container for bytes. either way tho, uint8_t is better and std::byte also exists.
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.
Yeah sorry, this std::string
should be string (UTF-8) data is sort of an assumption that I have picked up from my time at Google, but I do think std::vector<uint8_t>
communicates the semantics better. I looked at std::byte
and it doesn't plug into existing libraries as well, so I picked something that should integrate a little better with other C/C++ code.
redpanda::on_record_written( | ||
[](redpanda::write_event event, redpanda::record_writer* writer) { | ||
return writer->write(event.record); | ||
}); |
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.
well... that's neat
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.
Glad you like it :)
Hopefully this is a rather easy interface for folks to use. It's very similar to what Rust/Go looks like.
8e12c31
to
17262a1
Compare
Force push: Address comments and cleanup the history |
Add an experimental C++ SDK. This SDK closely follows the Rust implementation in terms of API. We intentionally keep the source to be a single implementation and header file for easy drop into existing or other build systems. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Add a simple CMake build for the C++ SDK. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Closely mirrors the config in the root of the Redpanda repo. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Add an example of using the C++ SDK for the identity transform. This inclues a CMake build to integrate the SDK. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
17262a1
to
b831ca7
Compare
Force push rebase against dev |
Add a README telling folks how to use the SDK along with a short overview. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
b831ca7
to
33a9c12
Compare
I squashed it up, still up to you if you want to go through the .cc more! Thanks again for the review |
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.
Took a non-exhaustive look at transform_sdk.cc
, and it looks pretty great. I don't want to hold this up any longer.
Add experimental C++ SDK. It's currently not going to be more formally supported in docs or RPK at the moment.
Most of the implementation here falls out from mirroring similar patterns from the Rust SDK.
Backports Required
Release Notes