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

Protobuf serialization #190

Closed
kesavkolla opened this issue Aug 29, 2022 · 7 comments
Closed

Protobuf serialization #190

kesavkolla opened this issue Aug 29, 2022 · 7 comments

Comments

@kesavkolla
Copy link

Can we implement protobuf mapping for cloud event? This will help in generating fast serialization and deserialization.

@jcrossley3
Copy link
Contributor

I'm open to it, but know nothing about doing it. Will we have to include generated code? Or integrate that into CI? What are the tradeoffs?

@kesavkolla
Copy link
Author

That is true for protobuf we need to create the proto files before hand. CloudEents can have arbitrary payload so might not work.

@Syndlex
Copy link

Syndlex commented Apr 25, 2023

I dont think this is a Problem.
The spec already provides a proto file.
https://github.com/cloudevents/spec/blob/main/cloudevents/formats/cloudevents.proto

I haven't writen Rust jet.
is this the part where you decide for a Serializer?
https://github.com/cloudevents/sdk-rust/blob/main/src/event/v10/format.rs#L103

@kesavkolla do you know the proto generator toolchain in rust?

The only think i do not understand is how we will get a proto payload into the data... But this is answert somewhere in the java SDK.
https://github.com/cloudevents/sdk-java/tree/main/formats/protobuf/src/main

@Lazzaretti
Copy link
Member

Hey @Syndlex
Great to see your interest in implementing this!
I would take a look at the Java SDK, too!

Here is the specification for the format: https://github.com/cloudevents/spec/blob/b43a64bf4fa92baee02dad512f23ea5cb77a321c/cloudevents/formats/protobuf-format.md

About the payload question: Please also take a look here: cloudevents/spec#1186

Feel free to create a PR if you like :)

@Syndlex
Copy link

Syndlex commented Apr 27, 2023

Hey @Lazzaretti
The java sdk has multiple published Modules.
Should the rust Lib also be divided in multiple crates?

I think @slinkydeveloper, you are the Maintainer of this Project. Any Architecture input into this Problem?

@Lazzaretti
Copy link
Member

Interesting question!
Please start that discussion on Slack if you don't mind :)
#cloudevents-sdk-rust channel under CNCF's Slack workspace.

We are four maintainers on the project: @jcrossley3, @linuxbasic, @slinkydeveloper, @Lazzaretti.

@slinkydeveloper
Copy link
Member

Hi,
I'm not very active anymore on this project, but here's my two cents:

  • From what I can tell from my experience with rust, features like supporting a different serialization format are shipped in the same crate behind a feature flag, rather than in a separate module. I wouldn't expect a different module for that.
  • It would be cool if we could simply integrate with prost by deriving/implementing the prost::Message trait on the Cloudevent object. Perhaps such implementation could simply proxy to the code-generated prost::Message from the proto file provided in the spec repo, so we wouldn't need to expose the protobuf message itself. Perhaps we could implement prost_reflect::ReflectMessage as well, to easily support reflections and DynamicMessage as well).

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

No branches or pull requests

5 participants