Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

grpc: Convert key to a bytes field #43

Merged
merged 1 commit into from
Jun 15, 2023
Merged

grpc: Convert key to a bytes field #43

merged 1 commit into from
Jun 15, 2023

Conversation

dfinkel
Copy link

@dfinkel dfinkel commented Jun 14, 2023

Galaxycache is perfectly fine with non-UTF-8 keys, but some go Protobuf library versions validate UTF-8 conformance when serializing string-fields.

We can side-step this by setting the field definitions to conform to the protobuf spec by putting our possibly-not-utf-8 strings in a bytes field.

Fortunately, string and bytes fields are 100% wire compatible, so switching the type only creates a mild API break.

I doubt anyone's using these protobuf messages directly, so I'm just going to declare that they aren't covered by v1.x compatibility.

Also, regenerate the protobuf types with the current protobuf library (google.golang.org/protobuf instead of github.com/golang/protobuf).

Include a test to guarantee that this does the right thing with invalid UTF-8.

Galaxycache is perfectly fine with non-UTF-8 keys, but some go Protobuf
library versions validate UTF-8 conformance when serializing
string-fields.

We can side-step this by setting the field definitions to conform to the
protobuf spec by putting our possibly-not-utf-8 strings in a bytes
field.

Fortunately, string and bytes fields are 100% wire compatible, so
switching the type only creates a mild API break.

I doubt anyone's using these protobuf messages directly, so I'm just
going to declare that they aren't covered by v1.x compatibility.

Also, regenerate the protobuf types with the current protobuf library
(google.golang.org/protobuf instead of github.com/golang/protobuf).

Include a test to guarantee that this does the right thing with invalid
UTF-8.
@dfinkel dfinkel requested review from arodland and silvenac June 15, 2023 16:06
@dfinkel dfinkel merged commit c7ef985 into master Jun 15, 2023
@dfinkel dfinkel deleted the grpc_bytes_key_field branch June 15, 2023 17:11
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants