-
Notifications
You must be signed in to change notification settings - Fork 87
proto string => bytes WIP #2354
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
Conversation
Update all string protobuf fields which use casttype `encoding/json.RawMessage` to instead be bytes. This is a correctness issue, and is required for correct processing semantics in later Go gRPC library versions. The decoder must be able to assume that a cast of []byte to a string field allows the []byte to be re-used post-cast, and the use of json.RawMessage breaks this assumption. It's also a performance concern, because `prost` in Rust is able to use zero-copy bytes::Bytes to back a `bytes` field, while String _must_ be deeply cloned.
Update post-processing of generated protobuf serde implementations to account for new bytes::Bytes underlying type.
Various mechanical updates to Rust crates to account for the String => bytes::Bytes conversion of affected fields.
21c7da8 to
16027b6
Compare
psFried
left a comment
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
| doc_json, | ||
| exists: meta.front(), | ||
| key_json: String::new(), // TODO(johnny) | ||
| key_json: bytes::Bytes::new(), // TODO(johnny) |
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.
nit: do you remember what these TODOs were for? Remove em?
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.
They're for plumbing in a json encoding (array) of the key, for connectors that prefer to work with JSON instead of packed foundation-DB tuples. Obviously hasn't been super important, but may be if we start to support user-implemented connectors.
Updates ATF to the latest protocol changes introduced in estuary/flow#2354.
Updates ATF to the latest protocol changes introduced in estuary/flow#2354.
Update all string protobuf fields which use casttype
encoding/json.RawMessageto instead be bytes.This is a correctness issue, and is required for correct processing
semantics in later Go gRPC library versions. The decoder must be able to
assume that a cast of []byte to a string field allows the []byte to be
re-used post-cast, and the use of json.RawMessage breaks this
assumption.
It's also a performance concern, because
prostin Rust is able touse zero-copy bytes::Bytes to back a
bytesfield, while String mustbe deeply cloned.
No semantic or wire changes to the protocol -- this is just a low-level refactor of the in-memory type representation.
Workflow steps:
(How does one use this feature, and how has it changed)
Documentation links affected:
(list any documentation links that you created, or existing ones that you've identified as needing updates, along with a brief description)
Notes for reviewers:
(anything that might help someone review this PR)
This change is