-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22714 from rockwotj/protobuf
Seastar friendly protobuf parser
- Loading branch information
Showing
16 changed files
with
1,869 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# See google/libprotobuf-mutator#91 | ||
|
||
cc_library( | ||
name = "libprotobuf_mutator", | ||
testonly = 1, | ||
srcs = glob( | ||
[ | ||
"src/*.cc", | ||
"src/*.h", | ||
], | ||
exclude = [ | ||
"**/*_test.cc", | ||
"src/mutator.h", | ||
], | ||
) + [ | ||
"port/protobuf.h", | ||
], | ||
hdrs = [ | ||
"src/mutator.h", | ||
], | ||
include_prefix = "protobuf_mutator", | ||
strip_include_prefix = "src", | ||
visibility = ["//visibility:public"], | ||
deps = ["@protobuf"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
load("//bazel:build.bzl", "redpanda_cc_library") | ||
|
||
redpanda_cc_library( | ||
name = "protobuf", | ||
srcs = [ | ||
"parser.cc", | ||
], | ||
hdrs = [ | ||
"parser.h", | ||
], | ||
include_prefix = "serde/protobuf", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//src/v/bytes:iobuf", | ||
"//src/v/bytes:iobuf_parser", | ||
"//src/v/container:chunked_hash_map", | ||
"//src/v/container:fragmented_vector", | ||
"//src/v/utils:vint", | ||
"@protobuf", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Protobuf Parser | ||
|
||
This directory contains a seastar friendly protobuf parser. | ||
It should adhere to the same compatibility guarantees as the offical C++ library | ||
but has a few notable differences: | ||
|
||
1. Does not make contiguous allocations of repeated fields, maps or strings/bytes types | ||
2. Is reactor friendly on deeply nested or large protobufs in that it will yield control | ||
3. Is a stackless parser, so it is not bound by the smallish 1MB stacks that seastar uses for threads | ||
|
||
## Development | ||
|
||
If you are tasked with updating this code, here are a few helpful links: | ||
|
||
1. [Encoding spec](https://protobuf.dev/programming-guides/encoding/) (note this elides some important details about how invalid/corrupted data is handled) | ||
2. [Golang protobuf parser](/~https://github.com/protocolbuffers/protobuf-go/blob/master/proto/decode.go) | ||
3. [Java protobuf parser](/~https://github.com/protocolbuffers/protobuf/tree/main/java/core/src/main/java/com/google/protobuf) | ||
4. [C++ protobuf parser](/~https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/wire_format_lite.cc) | ||
5. [Protobuf Zero](/~https://github.com/mapbox/protozero/blob/master/include/protozero/pbf_reader.hpp) |
Oops, something went wrong.