grpc: utilities for inter-converting grpc::ByteBuffer and Buffer::Instance.#6732
grpc: utilities for inter-converting grpc::ByteBuffer and Buffer::Instance.#6732htuch merged 19 commits intoenvoyproxy:masterfrom
Conversation
…tance and for adding gRPC frame headers to Buffer::Instances. Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
|
/retest |
|
🔨 rebuilding |
lizan
left a comment
There was a problem hiding this comment.
Great, a couple of style nits and some questions.
htuch
left a comment
There was a problem hiding this comment.
Looks good in general, a bunch of comments, mostly nits but a few thread related ones as well.
/wait
source/common/grpc/common.cc
Outdated
| delete container; | ||
| } | ||
| }; | ||
| // NB: addBufferFragment takes a pointer alias to the BufferFragmentImpl which is passed in so we |
There was a problem hiding this comment.
Can we just make fragments_ a unique_ptr and have it follow RAII?
There was a problem hiding this comment.
If I make it container->fragments_ = std::make_uniqueBuffer::BufferFragmentImpl[](slices.size());
Then I get an error because BufferFragmentImpl is not copyable:
unique_ptr.h:831:34: error: no matching constructor for initialization of 'remove_extent_t<Envoy::Buffer::BufferFragmentImpl []> []'
buffer_impl.h:430:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
Could you suggest an alternative?
There was a problem hiding this comment.
Can BufferFragmentImpl be made copyable?
There was a problem hiding this comment.
We could, but it was explicitly made NonCopyable because it is aliased by OwnedImpl, and therefore copying it could break the pointer from OwnedImpl, so I understand why it was made NonCopyable and I believe it needs to stay that way.
Any other ideas?
There was a problem hiding this comment.
In response to: "Can you elaborate?":
The BufferFragmentImpl is not owned by the OwnedImpl, instead it takes a reference to it, so allowing the BufferFragmentImpl to move could result in hard to find bugs if someone erroneously thought that implied that it was a value type as opposed to what it is: something with strong address-based identity.
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
…-grpc-common Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
|
/retest |
|
🔨 rebuilding |
|
OK, the tests now pass (except for the asan which I believe is unrelated). PTAL |
|
also, merging master would fix asan. |
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
…-grpc-common Signed-off-by: John Plevyak <jplevyak@gmail.com>
Done. |
Re: this comment, I'm not sure I grok the "aliased by OwnedImpl" bit. Can you elaborate? |
Signed-off-by: John Plevyak <jplevyak@gmail.com>
htuch
left a comment
There was a problem hiding this comment.
Great, thanks, appreciate your patience working through these issues.
* master: (88 commits) upstream: Null-deref on TCP health checker if setsockopt fails (envoyproxy#6793) ci: switch macOS CI to azure pipelines (envoyproxy#6889) os syscalls lib: break apart syscalls used for hot restart (envoyproxy#6880) Kafka codec: precompute request size before serialization, so we do n… (envoyproxy#6862) upstream: move static and strict_dns clusters to dedicated files (envoyproxy#6886) Rollforward of api: Add total_issued_requests to Upstream Locality and Endpoint Stats. (envoyproxy#6692) (envoyproxy#6784) fix explicit constructor in copy-initialization (envoyproxy#6884) stats: use tag iterator rather than constructing the tag-array and searching that. (envoyproxy#6853) common: use unscoped build target in generate_version_linkstamp (envoyproxy#6877) Addendum to envoyproxy#6778 (envoyproxy#6882) ci: add minimum Linux build for Azure Pipelines (envoyproxy#6881) grpc: utilities for inter-converting grpc::ByteBuffer and Buffer::Instance. (envoyproxy#6732) upstream: allow excluding hosts from lb calculations until initial health check (envoyproxy#6794) stats: prevent unused counters from leaking across hot restart (envoyproxy#6850) network filters: add `injectDataToFilterChain(data, end_stream)` method to network filter callbacks (envoyproxy#6750) delete things that snuck back in (envoyproxy#6873) config: scoped rds (2b): support delta APIs in ConfigProvider framework (envoyproxy#6781) string == string! (envoyproxy#6868) config: add mssing imports to delta_subscription_state (envoyproxy#6869) protobuf: add missing default case to enum (envoyproxy#6870) ... Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Signed-off-by: John Plevyak jplevyak@gmail.com
For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md
Description: Add utilities for converting between grpc::ByteBuffer and Buffer::Instance and
for adding gRPC frame headers to Buffer::Instances. This is in support for proving raw
(Buffer::Instance) gRPC support which is in support of #4272. This PR also renames Grpc::Common::serializeBody
to Grpc::Common::serializeToGrpcFrame which is a better description of the actual behavior
as per comments on #6525,
Risk Level: low
Testing: Complete unit tests provided.
Docs Changes: N/A
Release Notes: N/A
[Optional Fixes #Issue]
[Optional Deprecated:]